I figured we could set a main .tpl with different sections defined by sub .tpls. I'll take a look at other systems with a similar setup first though.
Although, this seems promising:
http://www.smarty.net/inheritance
Quote:
layout.tpl
PHP Code:
<html> <head> <title>{block name=title}Default Page Title{/block}</title> </head> <body> {block name=body}{/block} </body> </html>
mypage.tpl
PHP Code:
{extends file="layout.tpl"} {block name=title}My Page Title{/block} {block name=body}My HTML Page Body goes here{/block}
output of mypage.tpl
PHP Code:
<html> <head> <title>My Page Title</title> </head> <body> My HTML Page Body goes here </body> </html>
|
Quote:
Instead of managing our page layout in several files (header.tpl, footer.tpl, etc.), we now manage it in one cohesive template (layout.tpl), and define the changeable blocks of content with {block ...} tags. Now you can simply extend the layout.tpl (which basically copies it) and then customize any of the defined block elements. You can have any number of child templates chained together, thus the concept of inheritance.
|