Real new to php and I'm trying to do the following but keep running into walls.
Create 2 PHP pages that use the same Smarty template and contain the following:
• The first page should contain the title and heading of "Fruits".
• The second page should contain the title and heading of "Vegetables".
• The first page should contain a list of 5 fruits.
• The second page should contain a list of 5 vegetables.
• links to both pages at the bottom of the each page. (will do later)
• The template should use the same Smarty variable for the page title and
heading. The lists should use the section function.
The following are 3 of the 4 pages I need. I know that the fruits and veggie php pages will be somewhat the same. What I've got so far is a fruits.php, food.tpl, header.tpl. Obviously, all the basic html coding is missing.
fruits.php:
<?
require('/usr/local/lib/php/Smarty/Smarty.class.php');
$smarty = new Smarty;
$smarty->assign("title", 'Fruits');
$smarty->assign("foods", array('pears','mangos','apples','kiwi','grapes'));
$smarty->display('food.tpl')
?>
food.tpl:
{include file="header.tpl" title="Food List"}
<table>
{section name=mysec loop=$foods}
{strip}
<tr bgcolor="{cycle values='#eeeeee,#dddddd'}">
<td>{$foods[mysec]}</td>
</tr>
{/strip}
{/section}
</table>
header.tpl:
<title>{$title|default:"My Fruit List"}</title>