Re:AW: Re: Please help on caching
| From: | Brian E . Lozier | Date: | Sun, 30 Dec 2001 21:20:14 +0000 |
| Subject: | Re:AW: Re: Please help on caching | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-2447@lists.php.net to get a copy of this message | ||
The problem with your example is that it doesn't use ->fetch() to get the second template.
Does it still
parse any {$var} tags inside it? Regardless, it still won't work for my application since
it's always going
to be caching 'main.tpl' which can't work - because if the first person to hit it is
logged in, everyone
after will see the 'logged in as: [nick name]' message. And if the first person
isn't logged in, everyone
will see the login form, regardless of whether they're logged in.
Brian
------------------------------------
"How should I know if it works? That's what beta testers are for. I only coded it." -
Linus Torvalds
----- Original Message -----
From: "Werner Schweizer" <W.Schweizer@SwissOnline.ch>
To: smarty@lists.ispi.net
Date: 12/30/01 3:24:45 AM
>
>As you certainly noticed, my previous example had errors.
>
>Here the correct version:
>
>in xx.php
>---------
>
>$template = "whatever.tpl"; // .tpl name depending of xx.php or
>$REQUEST_URI
>$smarty->assign("template",$template);
>$smarty->assign("contents",$contents); // $contents filled by xx.php
>
>$smarty->display('main.tpl', $template . $REQUEST_URI);
>
>main.tpl
>--------
>
><html>
><body>
> {if !empty($template)}
> {include file=$template}
> {else}
> <h1>Error: No template specified</h1>
> {/if}
></body>
></html>
>
>This way the caching should work and has an unique id.
>Maybe you don't nead both, $template and $REQUEST_URI
>as cache id if your $template is a unique result of $REQUEST_URI.
>
>Werner Schweizer
>
>
>
>---
>You are currently subscribed to smarty as: brian@massassi.net
>To unsubscribe send a blank email to $subst('Email.Unsub')
>Visit Smarty's homepage at
>http://www.phpinsider.com/php/code/Smarty/