beginner, (for sure)
| From: | Peter J. Pieczora | Date: | Tue, 15 Jan 2002 07:48:07 +0000 |
| Subject: | beginner, (for sure) | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-2538@lists.php.net to get a copy of this message | ||
Hi,
Finally found some time to install, and play a bit with "smarty".
Quickly adapted, whatever I was using beforem to work with smarty, and came
up with something like that:
<?php
require("Smarty.class.php");
require ("lib/globals.php");
$calljava = "<script language=\"JavaScript\"
src=\"java_scripts/java_sr.js\"></script>\n";
echo $calljava;
$smarty = new Smarty;
//*titles
$page_titles ["home"] = "[ Home Page ]";
$page_titles ["portfolios"] = "[ Portfolios ]";
// bunch more $page_titles here
$smarty->assign("date",PrintDate("$date"));
$title = 'my_photography_site';
$smarty->assign("navigation", $smarty->fetch("navigation.tpl"));
$smarty->assign("navigation1", $smarty->fetch("navigation1.tpl"));
switch ($page)
{
case "":
$smarty->assign(array("title" => "$title"));
$smarty->assign("Content", $smarty->fetch("home.tpl"));
break;
default:
$smarty->assign(array("title" => "$title
$page_titles[$page]"));
$smarty->assign("Content", $smarty->fetch("$page.tpl"));
break;
}
$smarty->display('index.tpl',$REQUEST_URI);
$smarty->caching = true;
?>
So anyway, smarty displays it OK.
I wonder though, whether there is a better way to accomplish this.
Also, I wonder how to create an array of lets say
index.tpl, index2.tpl, index3.tpl, with slightly different design layout, and
depends on which link one happens to click smarty will display according
index.tpl file?
Cheers,
Peter