develooper Front page | perl.php.sandwich.dev | Postings from October 2005

Re: PHP Template Global Variables

Thread Previous | Thread Next
From:
George Schlossnagle
Date:
October 26, 2005 19:44
Subject:
Re: PHP Template Global Variables
Message ID:
43603EE1.7030809@omniti.com
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);


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About