Re: Question about Smarty
| From: | eddy kim | Date: | Mon, 18 Jun 2001 15:22:48 +0000 |
| Subject: | Re: Question about Smarty | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-894@lists.php.net to get a copy of this message | ||
I do something similar:
index.php
----------
[...]
/* Setup, get the page variable and do anything you need to it. I normalise it to make it as short as possible, since the value of the page variable is actually a path to a file. I also have a default set if page isn't. */
if ($page) {
// normalise
} else {
$page=default.html
}
// then do the assigns and start smarty
[...]
index.tpl
----------
[...]
{include file=$page}
[...]
This also means all the links in your site using this method need to be urls with the ?page=XXX format. I could see alternate ways of specifying the page.
Luc Saint-Elie wrote:
Hello, Sounds cool, could you elaborate ? In this case I'd have used : <tr><!-- this is dependent on a 'page' param, so you could for example call your site like this: index.php?page=help --><td>{if $page eq "help" }{include file= "stuff.tpl"} {/if}</td> </tr>En réponse à Ivo Jansch <ivo@ibuildings.nl>:Hi,--- You are currently subscribed to smarty as: ehkim@tsoft.com To unsubscribe send a blank email to leave-smarty-705849L@lists.ispi.net Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/Can this be done and if so has anyone tried it using Smarty? Basically I want one default.tpl page to structure the rest of the sites php output.You can do it like this: index.tpl: <table> <tr> <!-- always the same file throughout the site --> <td>{include file="top.tpl"}</td> </tr> <tr> <!-- this is dependent on a 'page' param,so you could for example call your site like this: index.php?page=help --><td>{include file=$page}</td> </tr> <tr> <!-- always the same file throughout the site --> <td>{include file="bottom.tpl"}</td> </tr> </table> Greetings, Ivo