View Single Post
  #7  
Old 10-01-2012, 09:30 AM
Tequila's Avatar
Tequila Tequila is offline
The Grim One
 
Join Date: Jan 2009
Location: Souther Tier, New York State
Posts: 1,356
Gender: Female
Credits: 97,183
Tequila is on a distinguished road
Default

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.
__________________
Artist. Designer. Gamer. Mother.
[portfolio] [tarot] [Rune Hollow] [freebies]

Last edited by Tequila; 10-01-2012 at 10:02 AM.