Re: [SMARTY] Another cache questions - "Dynamic into static content"

From: Date: Sun, 05 Jan 2003 00:10:21 +0000
Subject: Re: [SMARTY] Another cache questions - "Dynamic into static content"
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-7017@lists.php.net to get a copy of this message
hello, On Sat, Jan 04, 2003 at 02:30:42PM +0100, Erik Franzén wrote: > I have just been introduced to Smarty and have some questions that maybe > someone can answer? > > Suppose you are going to write a site consisting of a menu on top (called > menu) and below some type of information (called content) which you collect > from a database. > > Here you could use smarty to cache the page in order to minimize questions > to the database. > > Question 1 > If you don't want to cache the menu, how do you do it in smarty? I want to > "rebuild" the menu each time beacuse my visitors may not have the same menu > depending on if they are logged in or not. > The content should always be the same for all users. use {insert}. see: http://smarty.php.net/manual/en/language.function.insert.php > Question 2 > When a user doesn't have their cookies enabled then the session id, ?SID=#, > is appended to the links within the template. However if the cached > templates are created from the templates with the embedded SID the you have > a security problem as the users session could be passed to someone else. > How do I solve this? i would use session.use_trans_sid (explained in http://www.php.net/manual/en/ref.session.php ) . then the session-ids are applied to the links after outputting the cached template, so the session-ids are not cached. you can use ini_set('session.use_trans_sid', ... ) to enable and disable this feature dynamically. i did some testing on that a few weeks ago: you have to specify your flavour of session.use_trans_sid *before* you call session_start() explicitly or implicitly by session_id() or the like. all changes to session.use_trans_sid after session_start() are ignored. this worked with php-4.2.3 although it was never document. i don't think it works with 4.3.0 anymore but didn't test yet. have fun messju

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