In my comany project,due to no time to manage the web structure(php), only leave the pure php files and other scripts in my project.from now on,under the cerntain situation, and with the project on-going and extension,need apply some new style to reorganize the project, The first step is: separate the display and logics. then I select the smarty template as the cutting-point. what's more,I put down the configure.
1.Download Smarty package http://smarty.php.net/
2.Create a directory in web root such as app,then copy the libs folder under the smarty package to app folder.(my web root :C:/work/wwwroot)
3.Modify the php.ini for supporting the smarty template. add this in the php.ini:include_path=".;C:\Work\wwwroot\app\libs"
4.create templates,templates_c,configs,cache folders in the app directory.
5.write down index.php file in the app directory :
<?php
// load Smarty library
require('libs/Smarty.class.php');$smarty = new Smarty;$smarty->template_dir = 'templates';
$smarty->config_dir = 'config';
$smarty->compile_dir = 'templates_c';
$smarty->cache_dir = 'cache';
$smarty->assign('name','fish boy!');
$smarty->display('index.tpl');
?>
6.create a template file(index.tpl) in the templates folder:
<html>
<body>
Hello, {$name}!
</body>
</html>
Basically the directory structure is:
wwwroot
+app
+libs(files from smarty libs folder)
+templates(put the tpl file in this directory)
templates_c
configs
cache
7.run this http://localhost/app
分享到:
相关推荐
classSmarty2.6.18PHP模板Smarty2.6.18.rar
php smarty模板引擎 版本: smarty 2.6.18
Smarty-2.6.18 学习用最佳
samtry php程序开发 开源的 一种最常用的模板! (smarty php free)
最新版的smarty
php模版 (smarty)php模版 (smarty)php模版 (smarty)php模版 (smarty)php模版 (smarty)php模版 (smarty)php模版 (smarty)
php+smarty输出资讯列表,生成html静态
Smarty是一个使用PHP写出来的模板引擎,是目前业界最著名的PHP模板引擎之一。它分离了逻辑代码和外在的内容,提供了一种易于管理和使用的方法,用来将原本与HTML代码混杂在一起PHP代码逻辑分离。简单的讲,目的就是...
Smarty是一个使用PHP写出来的模板引擎,是业界最著名的PHP模板引擎之一。Smarty分离了逻辑代码和外在的内容,提供一种易于管理和使用的方法,用来将原本与HTML代码混杂在一起PHP代码逻辑分离。Smarty工作的目的是要...
Smarty-2.6.18.tar.gz压缩包 smarty中文手册.chm
php之smarty入门
PHP 5.2 标准课程中级Zend Framework和Smarty模板引擎介绍
DZ论坛 PHP插件开发[基于Smarty]DZ论坛 PHP插件开发[基于Smarty]DZ论坛 PHP插件开发[基于Smarty]DZ论坛 PHP插件开发[基于Smarty]DZ论坛 PHP插件开发[基于Smarty]DZ论坛 PHP插件开发[基于Smarty]DZ论坛 PHP插件开发...
PHP Smarty简体中文参考手册(让你更快速掌握PHP Smarty模板引擎,门户型网站常用技术)
PHP+smarty+购物网站,适合PHP刚接触smarty的初学者
1. PHP的基本语法。 2. SMARTY的使用。 3. 环境的搭建。 4. 第一个示例。 http://blog.csdn.net/dengxingbo/archive/2009/08/16/4450808.aspx
php+smarty简单新闻管理,便于快速理解smarty结构,方便ASP程序员快速转学PHP.
php+smarty分页类的具体使用之一
菜鸟学PHP之Smarty入门 php入门级教程 手把手教你学会smarty
linux+php+smarty模板的例子.zip PHP Web Development在Linux环境中配置(Smarty)