Przyklad:
index.php
<?php require('f:/smarty/libs/Smarty.class.php'); $smarty = new Smarty; $smarty->template_dir = 'd:/Apache2.2/htdocs/pm/smarty/templates'; $smarty->config_dir = 'd:/Apache2.2/htdocs/pm/smarty/configs'; $smarty->cache_dir = 'f:/smarty/smarty_cache';<!--html--><div class='htmltop'>HTML</div><div class='htmlmain'><!--html1-->$smarty->compile_dir = 'f:/smarty/templates_c'; $smarty->assign('name','fish boy!'); $smarty->display('index.tpl'); ?>
index.tpl
{$name}
Dziala elegancko ale jak zrobie tak:
index.php
<?php . . . // display it $smarty->display('index.tpl'); ?>
index.tpl
[/php]
. . . Friends List: {section name=i loop=$friends} {$friends[i]}<br> {/section}
To sie nic nie wyświetla...
Jakies sugestje ?
