Re: [SMARTY] cache and session ID

From: Date: Thu, 03 Apr 2003 22:47:20 +0000
Subject: Re: [SMARTY] cache and session ID
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9065@lists.php.net to get a copy of this message
On Thu, Apr 03, 2003 at 01:00:17PM -0800, Jacques Jocelyn wrote: > Hello Guys, > > I have a question regarding Caching and session id. > The web site requires to have a valid session_id for members to be > able to access to restricted data. > > To reduce the SQL server load, I use smarty caching for many pages. > the overall lifetime is about 1 through 2 hours. > many cached pages contain links to internal URL such as : > www.domain.tld/page.php/SID/12345 > > The issue is when a different visitors arrive on the website, HOW > can I return the cached page(with an old session_id) with the current session_id > (Real time) > > Please note, I have assign on all my pages the variable SID, for > instance : > $smarty->assign("SID", $SID); > $smarty->display("mytpl.tpl", $identifier); > > > I was thinking about modifying the $smarty->display() function by > adding a regex, but this will not be compatible with new smarty > version. if you want to avoid this. extend Smarty class, define your own display() and do function display(...) { ob_start(); parent::display(...); $output = ob_get_contents(); ob_end_clean(); /* run your output-filters on the cached contents here, replace your session-ids inside $output, for example. */ echo $output; } this is a performance hit against plain caching, of course, but it should work for quite some time. :) greetings messju > Please advise. > > Best regards, > Jacques > > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Jurist: Legastheniker des Fortschritts. (NJW Bd. 54 2001

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