I'm a newbe and I try to use Smarty.
I cann't find out how to display a template in the page contents cell.
Here is my code for index.php:
Code: Select all
<?php
require_once 'include/app_top.php';
$page = new Page();
$pageContentsCell = "e;first_page_contents.tpl"e;;
$page->assign('Links',
array('about' => 'templates/about_us.tpl', 'info' => 'templates/info.tpl'));
if (isset($Linksї'about']))
{
$pageContentsCell = "e;templates/about_us.tpl"e;;
}
$page->assign("e;pageContentsCell"e;, $pageContentsCell);
$page->display('index.tpl');
?>Code: Select all
{* smarty *}
{config_load file="e;site.conf"e;}
<!DOCTYPE html PUBLIC "e;-//W3C//DTD XHTML 1.0 Transitional//EN"e;
"e;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"e;>
<html xmlns="e;http://www.w3.org/1999/xhtml"e; xml:lang="e;en"e; lang="e;en"e;>
<head>
<link href="e;style.css"e; rel="e;stylesheet"e; type="e;text/css"e; />
<title>{#sitetitle#}</title>
</head>
<body bgcolor="e;#FFFFCC"e;>
{include file="e;header.tpl"e;}
<table cellspacing="e;0"e; cellpadding="e;0"e; width="e;760"e; height="e;100%"e; border="e;1"e; align="e;center"e;>
<tr>
<td valign="e;top"e; >
{include file="e;navigation.tpl"e;} </td>
<td>
{include file="e;$pageContentsCell"e;}
</td>
</tr>
</table>
</body>
</html>Code: Select all
{* navigation.tpl *}
<link href="e;style.css"e; rel="e;stylesheet"e; type="e;text/css"e; />
<script src="e;listmenu.js"e; type="e;text/javascript"e;></script>
<ul class="e;treemenu"e;>
</br>
<li><a href="e;"e;>Home</a></li>
<li class="e;treenode"e;>
<a href="e;"e;>info</a>
<ul>
<li><a href="e;{$Links.about}"e;>about</a></li>
<li><a href="e;"e;>List Item</a></li>
<li><a href="e;"e;>List Item</a></li>
<li><a href="e;"e;>List Item</a></li>
</ul>
</li>I'm not sure if I'm on the right track. Can anybody explain how this problem should be solved. And is there a way to make is simple, so I dont' have to call $pageContentsCell for all templates, like here $pageContentsCell = "templates/about_us.tpl";
Pelase help me