Smarty Templates
How to Install Smarty Securely
download smarty
untar/unzip smarty
put smarty library OUTSIDE docroot but in php include path
# mkdir /usr/share/php
# mv smarty/libs/ /usr/share/php/smarty
put smarty tempfiles OUTSIDE docroot
# cd /var/local
# mkdir smarty
# mkdir smarty/templates
# mkdir smarty/templates_c
# mkdir smarty/cache
# mkdir smarty/configs
# chown -R apache:apache smarty
Create PHP Smarty test file
$ cd webroot (ie /var/www/)
$ vi smarty.php
<?php
require 'smarty/Smarty.class.php';
$smarty =
new Smarty
();
$smarty->
template_dir =
dirname(__FILE__) ;
$smarty->
compile_dir =
'/var/local/smarty/templates_c';
$smarty->
cache_dir =
'/var/local/smarty/cache';
$smarty->
config_dir =
'/var/local/smarty/configs';
$smarty->
assign('name',
'GNU LINUX');
$smarty->
display('smarty.tpl');
?>
$ vi smarty.tpl
<html>
<head>
<title>Smarty</title>
</head>
<body>
Hello {$name}!
</body>
</html>
Smarty Sample App
http://www.smarty.net/sampleapp/sampleapp_p1.php∞
REFERRERS
FsseFrameworks
There are no comments on this page. [Add comment]