[bcc][faked-from] Re: [development] check_markup() question
Gordon Heydon
gordon at heydon.com.au
Thu Apr 13 22:27:38 UTC 2006
Hi,
On Thu, 2006-04-13 at 10:57 -0500, Allie Micka wrote:
> On Apr 13, 2006, at 9:56 AM, Mark Fredrickson wrote:
> >
> > A script should have information about both the person doing the
> > calling and the target individual. (eg. "Hello, my name is {John
> > Smith}, may I speak with {Janet Jones}? Hello {Ms. Jones}, I'd like
> > to talk to you about your key issue, {the environment}..." -- where
> > {} denotes a field from either the caller's or the target's
> > CiviCRM record). I've been storing the script in the node, but the
> > caller and target won't be known until later (when a user
> > participates in the phone bank).
>
> Ok, that I understand. This is being done in a number of places with
> Drupal (e.g. registration mails). And the code for it would be:
>
> $script = strtr($string, $variables);
>
> Or, if you want it to be translatable:
>
> $script = t($string, $variables);
>
> Where:
> $string = "Hello, my name is %caller_name, may I speak with %
> recipient_name?..."
> $variables = array('%caller_name' => 'John Smith', '%
> recipient_name' => 'Janet Jones');
>
> As you can see, the translation code itself is so succinct that it
> would be silly to write frameworks around it and it need not have
> anything to do with filters. The real heavy lifting is populating
> that $string and those $variables. I don't know how you'd generalize
> this - it's pretty application-specific.
Being able to use this as a filter will make the entire area much more
general. Not just doing this information. Also this means that you can
apply many filters not just the single filter that is being applied with
the current implementation.
Gordon.
More information about the development
mailing list