Re: PHP Template Global Variables
[email protected] (George Schlossnagle) Wed, 26 Oct 2005 22:43:45 -0400
| Newsgroups | perl.php.sandwich.dev |
|---|---|
| Message-ID | <[email protected]> |
David Wheeler wrote:
> On Oct 23, 2005, at 12:06 PM, Scott Lanning wrote:
>
>>> <?= $story->get_title() ?>
>>>
>>> Since the Bricolage templates are a relatively controlled
>>> environment, I'm
>>> personally not too worried about the pollution. But what do you think?
>>
>>
>> I think the same. It's consistent with other burners.
>
>
>
> Thanks, Scott. Unfortunately, that might make setting the $element
> variable too the current element by display_element() tricky.
> Currently, it'd done like this:
>
> $php->eval(q/function setBric($key, $var) {
> global $BRIC;
> $BRIC[$key] = $var;
> }/);
>
> $php->setBric(element => $elem);
The quick hack to make this work is to do:
$php->eval(qq/function setBric(\$key, \$var) {
global \$$key;
\$$key = \$var;
}/);
$php->setBric(element, $elem);