Cache and insert

From: Date: Sun, 26 Jan 2003 21:03:54 +0000
Subject: Cache and insert
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-7342@lists.php.net to get a copy of this message
I'm not sure if I have quite understood insert tag, but this is what I have: In categories.tpl I have something like this: {if $show == true} {foreach from=$al_name item=al_item} <p> {$al_item} - {cycle name=autor_name values=$user} {cycle name=autor_pname values=$user2} Some number: {cycle name=pic values=$nmr} </p> {/foreach} {/if} In my index.php I'm calling a function prepareData($id). That function looks like this in some sort of pseudocode: function prepareData($id) { $query = "select .... "; // get data from DB and asign it to arrays. assign arrays to smarty. if $number_rows == 0 then $show becomes false else { assign data to arrays assign arrays to smarty $show = true } } Now, I want to use cache, so I suppose I should put my function in plugin class, name it like insert_prepareDate and call it from categories.tpl. The problem is that now I have to make my output coded in a function, or I have understood it wrong? If this is rigth then all talk about layout and code separation loose it sense? Nino

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