Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Question about nested templates

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
mud
Smarty n00b


Joined: 25 Oct 2003
Posts: 3

PostPosted: Sat Oct 25, 2003 9:52 am    Post subject: Question about nested templates Reply with quote

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:

Arrow Can Smarty perform multiple inclusions?
Arrow Did I took the good logic to "dissect" my site?
Arrow If Smarty can, is this kind of logic fast to implement?
Arrow 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
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Sat Oct 25, 2003 11:09 am    Post subject: Reply with quote

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
View user's profile Send private message
mud
Smarty n00b


Joined: 25 Oct 2003
Posts: 3

PostPosted: Sun Oct 26, 2003 11:39 am    Post subject: Thanks for the advice Reply with quote

I'll try it very soon.... just hope that it will be easy to "convert" my old PHPLIB like website...
Back to top
View user's profile Send private message
mud
Smarty n00b


Joined: 25 Oct 2003
Posts: 3

PostPosted: Mon Oct 27, 2003 11:29 am    Post subject: Information request Reply with quote

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>


Arrow 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.
Question Should this logic be implemented in the associated php file, with assign function? Or can it be done in a different, more professionnal way?
Question 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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP