Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

header and footer question

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
coptang
Smarty n00b


Joined: 08 Apr 2007
Posts: 4

PostPosted: Sun Apr 08, 2007 1:24 pm    Post subject: header and footer question Reply with quote

Hi, I'm new to smarty but I've had a read of the docs and can't find an answer to my question:

My site header is very personalised and would require about 5 or 6 differnt var's passed to it. Do I have to do the following with each page template or is there an easier way?

{include file="header.tpl" var1=$var1 var2=$var2 var3=$var3 var4=$var4 var5=$var5}
page content, page content, page content, page content, page content, page content, page content, page content.
{include file="footer.tpl"}
Back to top
View user's profile Send private message
toma
Smarty Regular


Joined: 25 Apr 2003
Posts: 62

PostPosted: Sun Apr 08, 2007 6:03 pm    Post subject: Reply with quote

I prefer to assign page specific parameters before including the files:

{assign var="title" value="Page Title"}
{include file="header.tpl"}
Back to top
View user's profile Send private message Visit poster's website
coptang
Smarty n00b


Joined: 08 Apr 2007
Posts: 4

PostPosted: Mon Apr 09, 2007 7:13 pm    Post subject: Reply with quote

been playing a bit more and I think I'm going to use 3 smarty objects/templates: header, content and footer then just render them 1 after the other

unless that's horribly inefficient?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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