Free Software Server Environment : SmartyTemplates

HomePage :: Categories :: PageIndex :: RecentChanges
Search this site: FSSE.INFO is produced by "osde8info" :
http://www.smarty.net/quick_start.php
http://www.smarty.net/manual/en/language.function.php.php

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]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.0735 seconds