Re[8]: Caching all but part (fixed, ignore previous message)

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Re[8]: Caching all but part (fixed, ignore previous message)
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2621@lists.php.net to get a copy of this message
I agree my example isnt really separating php and layout logic... Exchange 'the ideal situation' in my last mail to 'a good way' :) Maybe this would be the ideal situation: The possibility to add your own tags and chosing weather they should be cached or not (I mean the second level of cacheing, of course, not the compilation) I believe you're already working on ways to let people add their own tags? Maybe something like {userloggedin} <a href="...:"...<...> {/userloggedin} 'userloggedin' being defined somehow by the sitedeveloper. Either the developer who defines the tag should be able to tell weather it should be staticly cached or 'inserted', or it could be optional (does that make sence?) like {userloggedin cache=false} <a href="...:"...<...> {/userloggedin} /l On Wed, 30 Jan 2002 14:17:30 -0600 Monte Ohrt <monte@ispi.net> wrote: > Then why use Smarty? :-) We whant to separate PHP logic from template > logic, that is the idea. {php} tags are there for some reason, I forget > why :-) > > Either use insert tags with template files, or handle them separately > and piece them together from the application side. > > if(foo) { > $output .= $smarty->fetch('first_block.tpl'); // not cached > } > > $output .= $smarty->fetch('main_content.tpl'); // cached > > echo $output; > > Linus McCabe wrote: > > > > That's a whole lot better than what I have now, but to me, the ideal > > situation would be if php-blocks could be un-cached, comething like: > > > > {php cache=false} > > if(blahblah) { > > {/php} > > <a href.... >blah</a> > > {php cache=false} > > } > > {/php} > > > > Would this be possible to implement? > > > > /l > > > > On Wed, 30 Jan 2002 13:22:32 -0600 Monte Ohrt <monte@ispi.net> wrote: > > > > > as for the HTML issue, pass a template as a parameter to insert: > > > > > > {insert name=foo tpl="my.tpl"} > > > > > > Then have the insert function fetch the template and return the > results. > > > This way you still keep your HTML in templates. > > > > > > Linus McCabe wrote: > > > > > > > > Yes, of course, ignorant of me to forget them in the first mail: > > > > > > > > function insert_userLoggedIn($args, $smarty) { > > > > global $auth; > > > > > > > > if($auth) > > > > return urldecode($args["true"]); > > > > else > > > > return urldecode($args["false"]); > > > > > > > > } > > > > > > > > This one might also come handy (is there a better way to do > this??) > > > > > > > > function insert_variable($args, $smarty) { > > > > global $vars; > > > > > > > > return $vars[$args["variable"]]; > > > > } > > > > > > > > Put the functions in a file and put the filename in the 'script' > tag > > > of the > > > > insert tag: > > > > > > > > {insert script="insert_site_functions.php" ... > > > > > > > > /linus > > > > > > > > On Wed, 30 Jan 2002 20:19:07 +1300 Patrick Quinn-Graham > <me@pftqg.com> > > > wrote: > > > > > > > > > Could you show me the insert_site_functions.php source? (or at > least > > > the > > > > > bit that pertains to this)... and what I have to do to Smarty to > use > > > it, > > > > > etc. > > > > > > > > > > Thanks :-). > > > > > > > > > > > > > > > -----Original Message----- > > > > > From: Linus McCabe [mailto:Linus@McCabe.nu] > > > > > Sent: Wednesday, 30 January 2002 7:36 p.m. > > > > > To: smarty@lists.ispi.net > > > > > Subject: [smarty] Re[2]: Caching all but part (fixed, ignore > previous > > > > > message) > > > > > > > > > > > > > > > > > > > > > > > > > I've done somehting similar to this: > > > > > > > > > > <%insert script="insert_site_functions.php" > > > > > name="userLoggedIn" > > > true=" > > > > > > > > > %3Ca+class%3D%22submenu%22+href%3D%22{$site_url}%3Ffunc%3Dcore%3A%3Aps_us > > > > > e > > > > > r > > > > > -%3Elogout%22%3ELogout%3C%2Fa%3E%3Cbr%3E > > > > > " false=" > > > > > > > > > %3Ca+class%3D%22submenu%22+href%3D%22{$site_url}community%2Flogin.php%22% > > > > > 3 > > > > > E > > > > > Login%3C%2Fa%3E%3Cbr%3E > > > > > "%> > > > > > > > > > > So, the "userLoggedIn function inserts either the 'true' or > > > > > the > > > 'false' > > > > > part if the user is logged in / not logged in. > > > > > > > > > > This works, but since the true and false parts contains " and > other > > > > > characters, I have to write it URL-encoded. > > > > > > > > > > Is there a better way to do this, so that the true and false > parts > > > can > > > > > still be written in clear text? (I don't want the html as a part > of > > > the > > > > > function!) > > > > > > > > > > /Linus > > > > > > > > > > (Sorry, Monte - didnt mean to send it to your personal mail, > still > > > didnt > > > > > get used to this email program) > > > > > > > > > > On Tue, 29 Jan 2002 23:59:32 -0600 Monte Ohrt <monte@ispi.net> > wrote: > > > > > > > > > > > check out the insert function, see if that could help. > > > > > > > > > > > > Patrick Quinn-Graham wrote: > > > > > > > > > > > > > (sorry, it appears outlook screwed up my digital sig) > > > > > > > > > > > > > > I want to cache all of a page except a little bit (wich is a > > > simple > > > > > > > {if}{else}{/if} block). > > > > > > > > > > > > > > Is there a way to do this? > > > > > > > > > > > > > > Thanks. > > > > > > > > > > > > > > Patrick. > > > > > > > > > > > > > > --- > > > > > > > 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/ > > > > > > > > > > > > > > > > > > --- > > > > > > You are currently subscribed to smarty as: linus@mccabe.nu > > > > > > To unsubscribe send a blank email to > > > > > $subst('Email.Unsub') > > > > > > Visit Smarty's homepage at > > > http://www.phpinsider.com/php/code/Smarty/ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --- > > > > > You are currently subscribed to smarty as: me@pftqg.com > > > > > To unsubscribe send a blank email to > > > $subst('Email.Unsub') > > > > > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ > > > > > > > > > > > --- > > > > > You are currently subscribed to smarty as: linus@mccabe.nu > > > > > To unsubscribe send a blank email to > > > $subst('Email.Unsub') > > > > > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ > > > > > > > > > > > > > --- > > > > 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/ > > > > > > > --- > > 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/ >

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