A subpage is the lowest entry in the hierarchy: A page can contain multiple subpages. This is useful if you want to separate one page into smaller sub-parts, e.g. split the documentation of a specific topic into multiple sub-sections.
As a page, also sub-pages are Smarty-Templates and have access to all
template variables. Sub-Pages are stored in the format pages/[page-name].[subpage-name].html
. E.g. this page is stored as pages/usage.writing.html
.
Config::set('pages',array(
'index' => array('title' => 'Overview','iconCls'=> 'icon-home'),
'usage' => array('title' => 'Usage','iconCls' => 'icon-wrench','layout'=>'layout',
'subpages' => array(
'requirements' => array('title' => 'Requirements'),
'configuration' => array('title' => 'Configuration')
)
)
)
Subpages are defined by defining a subpages
array within a pages config. The subpage config itself is the same as for pages: All attributes set can later be accessed in the
template.
The page configuration attribute defaultSubpage
defines, which subpage should be displayed by default, when the page is requested without subpage request. This is useful if you don't want to display an inttroducory page for subpages, but want to display the first subpage directly.
Subpage content can be displayed within the actual page by using the $subpage_content
template variable.
An example of a page including links to all its sub-pages and the content itself:
<div class="menu">
<ul>
{foreach $page.subpages as $key=>$subconfig}
<li class="{($sub_key==$key)?'active':''}
<a href="{$subconfig.link}">{$subconfig.title}</a>
</li>
{/foreach}
</ul>
</div>
<div class="subpage_content">
{$subpage_content}
</div>