Re: [SMARTY] parse config vars in variable

From: Date: Thu, 19 Jun 2003 11:59:08 +0000
Subject: Re: [SMARTY] parse config vars in variable
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9729@lists.php.net to get a copy of this message
http://smarty.php.net/manual/en/template.resources.php http://smarty.php.net/manual/en/language.function.eval.php have fun messju On Thu, Jun 19, 2003 at 01:50:05PM +0200, Martin Kloss wrote: > hi there, > > I'm banging my head and can't seem to see the obvious, > so please help me out here :-) > > I'm pulling contents from a database and assign it to > a variable (actually it's an array of contents): > > $smarty->assign('contents', $contents); > > Now the content contains text, which can also contain > config vars, i.e. > > {#font_header#} Great article > {#font_normal#} This is an article about... > > To display the content, I have a "content.tpl", which > loops through the array: > > {foreach from=$contents item="cname"} > {foreach from=$cname item="c"} > {$c.content} > {/foreach} > {/foreach} > > But when the content gets compiled with the display() > function, the "content" variable (obviously) does not get > evaluated, so the config vars are treated as plain text: > > IS: > New articles: > {#font_header#} Great article > {#font_normal#} This is an article about... > ... > > NEED BE: > New articles: > <font face="..." size=3>Great article</font> > <font face="..." size=2>This is an article about... > ... > > How can parse the config vars in the "content" variable? > I thought of creating a pre-filter, but that would be like > reinventing the wheel since that's what Smarty does, > replacing placeholders in templates. > Any ideas? I feel like I don't see the obvious, others > must have had the same problems before. > > Martin. > > > Martin Kloss > martin.kloss@triquart.de > Technische Direktion > > ************************ > Triquart Neue Medien > Bellealliancestr.17 > 20259 Hamburg > Germany > Tel.+49 (40)432 923-0 > Fax +49 (40)432 923-23 > www.triquart.de > www.triquart-humor.de > ************************* > > "Lingo objektorientiert" > Das Buch zum Autor jetzt bestellen unter: > http://www.amazon.de/exec/obidos/ASIN/3898422194/lingmmugd > >

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