Re: How to use a Smarty variable in an external source ?
| From: | Jason Sweat | Date: | Mon, 23 Jul 2001 03:23:20 +0000 |
| Subject: | Re: How to use a Smarty variable in an external source ? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1237@lists.php.net to get a copy of this message | ||
This is similar to a thread I brought up earlier. The only idea I came up
with was to have one template dynamically generate another, the call the
second template with PHP. While this would work, it would always have to be
compiled because it would be "new" every time, even if it did not "really"
change.
Maybe if we could hand Smary and identifier for the template, it could
internally keep track of something like the length and checksum for the
template to determine if in needs recompiling... I would think this is
something like what they must have had to consider when thinking about
storing templates in a database.
Jason
----- Original Message -----
From: "Luc Saint-Elie" <luc@saint-elie.com>
To: <smarty@lists.ispi.net>
Sent: Sunday, July 22, 2001 6:46 AM
Subject: [smarty] How to use a Smarty variable in an external source ?
> Hello,
>
> I know the title is strange.
>
> If I do in my .php file $tpl->assign('variable', $myvariable); I can do in
> my template {$variable} and the value of $myvariable is displayed in the
> resulting HTML file.. OK
>
> But if I have an external file (in my case its a XML file but I suppose
> the same question would apply to a piece of text stored in mySQL) that
> contains {$variable}, then I process this file to inject it in the
> template.. how to have Smarty process {$variable}
>
> In my case I have in the XML file
> ....[some XML]....
> <![CDATA[......{$variable}.....]]>
> ....[some XML]....
>
> This XML is then processed through a XML parser (phpxml) to output
arrays,
> these arrays been send to a Smarty template.
> In the resulting HTML file I have the string " {$variable}" and not the
> value of $myvariable displayed.
>
> Ho could I do that ?
>
> Thanks in advance a excellent week end to every one
>
> Luc
>
>
> ---
> You are currently subscribed to smarty as: sweatjejm@home.com
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/