|
|
Home patTemplate Freqently Asked Questions Can I re-use templates in different pages? |
| Can I re-use templates in different pages? |
|
|
|
|
Of course you can. Let's say you'v got a footer and a header, which should be the same in all of your pages, so you have to change it only once and it will be updated in all pages. 001 <patTemplate:tmpl name="header"> 002 <h1>My Superhero database</h1> 003 </patTemplate:tmpl> and this: 001 <patTemplate:tmpl name="footer"> 002 <hr/> 003 <span class="footer"> 004 Superhero database was last updated on 2001-12-24 (Oh, christmas). 005 </span> 006 </patTemplate:tmpl> Now you may include these two files in all other pages by using the src attribute of the <patTemplate:tmpl> tag: 001 <patTemplate:tmpl name="page"> 002 <html> 003 <head> 004 <title>Any page of the superhero database</title> 005 </head> 006 <body> 007 <patTemplate:tmpl name="includedHeader" src="header.tmpl" parse="on"/> 008 Here is the rest of the page... 009 Can be anything from static HTML to other templates. 010 <patTemplate:tmpl name="includedFooter" src="footer.tmpl" parse="on"/> 011 </body> 012 </html> 013 </patTemplate:tmpl>
Organizing templates in folders |
|
| Last Updated ( Tuesday, 01 November 2005 ) |
| < Prev |
|---|





