欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2/Agda, C++/Lisp/Haskell
Smarty
来自开放百科 - 灰狐
(版本间的差异)
| 第3行: | 第3行: | ||
Smarty : PHP Template Engine | Smarty : PHP Template Engine | ||
| + | ==Start== | ||
| + | templates\index.tpl | ||
| + | {* Smarty *} | ||
| + | Hello, {$name}! | ||
| + | hello.php | ||
| + | <?php | ||
| + | require('C:/wamp/www/smarty/Smarty.class.php'); // Windows | ||
| + | require('/usr/local/lib/php/Smarty/Smarty.class.php'); // Linux | ||
| + | $smarty = new Smarty; | ||
| + | |||
| + | $smarty->template_dir = 'templates/'; | ||
| + | $smarty->compile_dir = 'templates_c/'; | ||
| + | $smarty->config_dir = 'configs/'; | ||
| + | $smarty->cache_dir = 'cache/'; | ||
| + | |||
| + | $smarty->assign('name','Smarty'); | ||
| + | $smarty->display('index.tpl'); | ||
| + | ?> | ||
==Links== | ==Links== | ||
*http://smarty.php.net/ | *http://smarty.php.net/ | ||
2010年8月28日 (六) 10:41的版本
Smarty : PHP Template Engine
Start
templates\index.tpl
{* Smarty *}
Hello, {$name}!
hello.php
<?php
require('C:/wamp/www/smarty/Smarty.class.php'); // Windows
require('/usr/local/lib/php/Smarty/Smarty.class.php'); // Linux
$smarty = new Smarty;
$smarty->template_dir = 'templates/'; $smarty->compile_dir = 'templates_c/'; $smarty->config_dir = 'configs/'; $smarty->cache_dir = 'cache/';
$smarty->assign('name','Smarty');
$smarty->display('index.tpl');
?>
Links
分享您的观点