Re: [SMARTY] parse config vars in variable

From: Date: Thu, 19 Jun 2003 12:45:10 +0000
Subject: Re: [SMARTY] parse config vars in variable
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9732@lists.php.net to get a copy of this message
At 13:59 19.06.2003 +0200, you wrote:
http://smarty.php.net/manual/en/template.resources.php http://smarty.php.net/manual/en/language.function.eval.php have fun
hmm, I read that, but it doesn't quite do what I need. Here's what I do (not actual code, just to clarify): I'm pulling contents from the db, using my generic db wrapper which returns the desired content: $contents = $DB->get_record ('id', $id); or $contents = $DB->get_records ('id,content', "language = '" . $site->language . "' AND name = '$name"); and assign the content to a smarty variable: $site->assign('contents', $contents); This happens in a php module script, which gets loaded by the main module, the index.php. This main module also loads all needed templates, in this case the content.tpl, which looks like this: {* Start Content *} {foreach from=$contents item="cname"}
        {foreach from=$cname item="c"}
                {$c.content}
        {/foreach}
{/foreach} {* End Content *} Finally, the main module index.php dislays the content.tpl with all the contents: $site->display('content.tpl'); BUT, in this case the display method parses the content.tpl and NOT the text which it outputs. So I tried modifying the content.tpl to get the variable modified, but that didn't work either: {foreach from=$cname item="c"}
                {eval var=$c.content}
{/foreach} So how can I make sure the text in $c.content inside the content.tpl gets evaluated by Smarty? Martin.

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