|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
mud Smarty n00b
Joined: 25 Oct 2003 Posts: 3
|
Posted: Sat Oct 25, 2003 9:52 am Post subject: Question about nested templates |
|
|
I am completely new to Smarty, but I ever did Templating with PHPLIB's templates. At that time, I was used to use different template, one for each element. So I had one index.tpl, one menu.tpl, one poll.tpl etc.
It was quite easy for me to maintain & to fix problems for each of my elements.
So here is the question:
Can Smarty perform multiple inclusions?
Did I took the good logic to "dissect" my site?
If Smarty can, is this kind of logic fast to implement?
Was Smarty designed to do this kind of job?
I asked these questions, because, contrary to other template's systems, like fasttemplates, I didn't found ANY tutorials related to inclusion of files.
Thx for all answers, When I tried it, I made Smarty my own. |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Sat Oct 25, 2003 11:09 am Post subject: |
|
|
That should work fine with Smarty. You can include templates, nest includes and assign the result of the template to a template variable. You can have dynamic inclusion and you can load templates not only from the filesystem, but also custom resources.
See: http://smarty.php.net/manual/en/language.function.include.php |
|
Back to top |
|
mud Smarty n00b
Joined: 25 Oct 2003 Posts: 3
|
Posted: Sun Oct 26, 2003 11:39 am Post subject: Thanks for the advice |
|
|
I'll try it very soon.... just hope that it will be easy to "convert" my old PHPLIB like website... |
|
Back to top |
|
mud Smarty n00b
Joined: 25 Oct 2003 Posts: 3
|
Posted: Mon Oct 27, 2003 11:29 am Post subject: Information request |
|
|
What can I do if I have one principal template which looks like this one
index.tpl
Code: |
<html>
<body>
<table>
<tr>
<td>{include file="menu.tpl"}{*AREA 1: THAT DON'T CHANGE AT ALL*}</td>
<td>{*AREA 2: FOR LOTS OF DIFFERENT KINDS OF TEMPLATES*}</td>
</tr>
</table>
</body>
</html>
|
The problem I have is to code the AREA 2. As it comes from several templates, depending of the situation, I don't know how should I process.
Should this logic be implemented in the associated php file, with assign function? Or can it be done in a different, more professionnal way?
I would like to know if there is a complete tutorial on how to process nested templates (I have the impression that I'm the only one who want to do this!) |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|