Re[2]: [PHP] Mixing PHP code with phplib templates... possible?
| From: | Max A. Derkachev | Date: | Wed, 07 Feb 2001 08:42:25 +0000 |
| Subject: | Re[2]: [PHP] Mixing PHP code with phplib templates... possible? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-38510@lists.php.net to get a copy of this message | ||
Hello derek,
Tuesday, February 06, 2001, 7:58:25 PM, you wrote:
df> Hi Max,
df> Thanks for the reply. Unfortunately, the solution you suggest means
df> that I would have to do a set_var on all hyperlinks (i.e., define all
df> hyperlinks everywhere on the site), which is a huge amount of
df> maintenance. What I thought about yesterday was creating some sort
df> of token (e.g., {@@@@@}) that could be tacked onto the end of
df> hyperlinks that I want to add session info to.
Of course, you can have static hyperlinks in your template, ending
with, say, {sessinfo},
e.g. <a href='somedir/somescript.php{sessinfo}'>blabla</a>
and then in the script:
$tpl->set_var('sessinfo', ((SID) ? '?'.SID : ''))
df> Maybe there's a
df> better way... I don't know! :(
Another way is to turn output buffering on before processing the
template, and after $tpl->pparse(...) save the buffer, and apply a
regexp to it, which would append session info to every link on the
page.
And the last, should-be the best way. Compile PHP with
--enable-trans-sid and forget about manual appending the session info
to the links and forms.
--
Best regards,
Max A. Derkachev mailto:kot@books.ru
Symbol-Plus Publishing Ltd.
phone: +7 (812) 324-53-53
http://www.Books.Ru -- All Books of Russia