Re[2]: [SMARTY] Re-compiling templates?

From: Date: Tue, 11 Mar 2003 15:03:07 +0000
Subject: Re[2]: [SMARTY] Re-compiling templates?
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8554@lists.php.net to get a copy of this message
Hi Messju, >> for porting an existing application I need to have a mechanism >> to compile/parse the templates twice: >> - in a first round has to be assigned the biggest part of data, >> taking much time to access the database. After that the template >> has to be cached. >> - in a second round some minor changes have to be applied to the >> (cached or rebuild) template. > for the first round you enable caching. > for the second part you should use {insert} functions. Ah :) Hmm, as far I understand that insert.function mechanism, it's not applicable in this case. (Or am I wrong?) For example: <ul> {foreach from=$locations item=location} <li>{$location->getTitle()} [edit_link] {/foreach} </ul> [edit_link_definition] <a href="location_edit.php&locationId={$location->getID()}">edit</a> [/edit_link_definition] How do I get the edit_link parsed in at [edit_link] depending on some condition? If it was possible to get Smarty to really parse the template twice, I could do something like: <ul> {foreach from=$locations item=location} <li>{$location->getTitle()} {$location->getAdminName()} {literal}{if $session->isLoggedIn()}{/literal} <a href="...{$location->getID()}">edit</a> {literal}{/if}{/literal} {/foreach} </ul> I think, this would be straight forward, because I could use build-in functions like if/else, foreach, section etc. in the first and the second part. Sven

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