Re: How to use a Smarty variable in an external source ?

From: Date: Mon, 23 Jul 2001 14:24:35 +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-1242@lists.php.net to get a copy of this message
You will need to include the external source as a template. If there are no other curly braces in the XML file, should should be able to just include it. {include file="foo.xml"} And if this XML file is coming from a database or other resource, you will want to create a resource function and register it. {include file="xml:foo.xml"} Luc Saint-Elie wrote: > > 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: monte@ispi.net > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ -- Monte Ohrt <monte@ispi.net> http://www.ispi.net/

« previous php.smarty.general (#1242) next »