dyamic include file variable
| From: | Darryl Bleau | Date: | Thu, 09 Jan 2003 00:10:32 +0000 |
| Subject: | dyamic include file variable | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-7068@lists.php.net to get a copy of this message | ||
Hi all, and a quick hello to everyone.
This might be quite a newbie question.. I hope not, but I am relatively new to PHP in general.
I want to use index.php in my doc root as a controller to all functionality on my web page. So, it
will handle all the business logic and assign things as required. I want it to call a 'master
template' (as it were) that looks something like this:
{config_load file=3D"site.cfg" scope=3D"global"}
{include file=3D"header.tpl"}
{include file=3D"{$Include}"}
{include file=3D"footer.tpl"}
I think you should be able to see where I'm going with this.. I want to assign the $Include
variable in index.php according to what I want to show. (With
assign("Include","main.tpl"); or whichever page). I could just call the template
I want and put the includes at the top and bottom of each one but I was hoping I wouldn't have
to. I tried playing around with eval() to make this work but I think I'm missing something. Oh
the output I get when I try this is something like "} (and that's it).
If anyone has an idea or a suggestion on a different way to approach this it would be appreciated.
Thanks,
Darryl Bleau