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:
<?php
require_once 'include/app_top.php';
$page = new Page();
$pageContentsCell = "first_page_contents.tpl";
$page->assign('Links',
array('about' => 'templates/about_us.tpl', 'info' => 'templates/info.tpl'));
if (isset($Links['about']))
{
$pageContentsCell = "templates/about_us.tpl";
}
$page->assign("pageContentsCell", $pageContentsCell);
$page->display('index.tpl');
?>
code for index.tpl:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
<title>{#sitetitle#}</title>
</head>
<body bgcolor="#FFFFCC">
{include file="header.tpl"}
<table cellspacing="0" cellpadding="0" width="760" height="100%" border="0" align="center">
<tr>
<td valign="top" >
{include file="navigation.tpl"} </td>
<td>
{include file="$pageContentsCell"}
</td>
</tr>
</table>
</body>
</html>
and navigation.tpl
{* navigation.tpl *}
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="listmenu.js" type="text/javascript"></script>
<ul class="treemenu">
</br>
<li><a href="">Home</a></li>
<li class="treenode">
<a href="">info</a>
<ul>
<li><a href="{$Links.about}">about</a></li>
<li><a href="">List Item</a></li>
<li><a href="">List Item</a></li>
<li><a href="">List Item</a></li>
</ul>
</li>
when I try to open "about"(about_us.tpl) I get just html code of the template. It isn't displayed in the page contents cell as desired.
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 🙁