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

Replace Templates

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


Joined: 26 Feb 2011
Posts: 1

PostPosted: Sat Feb 26, 2011 1:10 pm    Post subject: Replace Templates Reply with quote

How can i replace the regular template of the page with my custom template (with my own tags)?
e.g.
Code:
<body>{content}</body>

with
Code:
<body>{myblock}{content}{/myblock}</body>

Where can i read about it.

Thank you.
Back to top
View user's profile Send private message Send e-mail
ChrisFah
Smarty Pro


Joined: 02 Nov 2009
Posts: 159
Location: Traun, Austria

PostPosted: Sat Feb 26, 2011 1:44 pm    Post subject: Reply with quote

Try this:
$condition is an condition to switch between orig and alternate content (whatever your condition is)

Code:

<body>
{if $condition}{content}{else}{other_content}{/if}
</body>

Regards, Chris
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Sat Feb 26, 2011 2:18 pm    Post subject: Reply with quote

Use template inheritance. You can put a block around any content, and selectively replace it by extending the template.
Back to top
View user's profile Send private message Visit poster's website
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