<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://jackxiang.com/post//</link>
<title><![CDATA[ [PHP]笑谈配置,使用Smarty技术]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Wed, 27 Dec 2006 05:12:18 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	相关知识:<br/>1:配置,链接access数据库是如此简单<br/><br/>2 : 模板引擎Smarty深入浅出介绍<br/><br/><br/>Smarty技术是PHP的精髓所在,随着PHP版本的逐渐提高,原来的很多方法也许太过时了,下面我就针对最新的PHP5.1.1版本的使用,配置说说如何配置.<br/><br/>下面是一步步的来的,请注意:<br/><br/>1: 在官方下载模板库文件: http://smarty.php.net/download.php<br/><br/>下载了就解压,看见一个文件夹了,是个 smarty.x.x,打开,里面有个libs 文件夹,ok,注意这个东西就是我们要的.<br/><br/>2: 在你的网站目录下面,比方我的php网站IIS在物理硬盘的 d:/web/web/php下面,在这个文件夹下面建立:一个文件夹 test,然后我们把刚提到的 libs文件夹复制道test 文件夹下面.{ * 请看本文最后的注释 TIPS1}<br/><br/>3:在test 文件夹下面再建立4个文件夹;<br/>cache<br/>configs<br/>templates<br/>templates_c<br/><br/>4:建立文件 text.htm:<br/><br/>&lt;html&gt;<br/>&lt;head&gt;<br/>&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot;&gt;<br/>&lt;title&gt;&lt;{$title}&gt;&lt;/title&gt;<br/>&lt;/head&gt; <br/>&lt;body &gt;<br/>&lt;{$content}&gt;<br/>&lt;/body&gt;<br/>&lt;/html&gt;<br/><br/><br/><br/>保存在 templates 目录下面.<br/><br/>5:然后建立文件模板配置文件: config.php<br/><br/>&lt;?php <br/>&nbsp;&nbsp;&nbsp;&nbsp;include &quot;../libs/Smarty.class.php&quot;; <br/> $NowPathArray=explode(&quot;test&quot;,str_replace(&quot;&#92;&#92;&quot;,&quot;/&quot;,dirname(__FILE__))) ;<br/>&nbsp;&nbsp;&nbsp;&nbsp;@define(&quot;root_path&quot;, $NowPathArray[0]);<br/>&nbsp;&nbsp;&nbsp;&nbsp;@define(&#039;__SITE_ROOT&#039;, root_path.&quot;test&quot;); <br/>&nbsp;&nbsp;&nbsp;&nbsp;$tpl = new Smarty(); <br/>&nbsp;&nbsp;&nbsp;&nbsp;$tpl-&gt;template_dir = __SITE_ROOT . &quot;/templates/&quot;; <br/>&nbsp;&nbsp;&nbsp;&nbsp;$tpl-&gt;compile_dir = __SITE_ROOT . &quot;/templates_c/&quot;; <br/>&nbsp;&nbsp;&nbsp;&nbsp;$tpl-&gt;config_dir = __SITE_ROOT . &quot;/configs/&quot;; <br/>&nbsp;&nbsp;&nbsp;&nbsp;$tpl-&gt;cache_dir = __SITE_ROOT . &quot;/cache/&quot;; <br/>&nbsp;&nbsp;&nbsp;&nbsp;$tpl-&gt;left_delimiter = &#039;&lt;{&#039;; <br/>&nbsp;&nbsp;&nbsp;&nbsp;$tpl-&gt;right_delimiter = &#039;}&gt;&#039;; <br/>?&gt; <br/><br/><br/>保存在主目录也就是 test下面.<br/><br/>6 :在test新建文件test.php文件,输入:<br/><br/>&lt;?php <br/>&nbsp;&nbsp;&nbsp;&nbsp;require &quot;config.php&quot;; <br/>&nbsp;&nbsp;&nbsp;&nbsp;$tpl-&gt;assign(&quot;title&quot;, &quot;测试成功了,这是标题&quot;); <br/>&nbsp;&nbsp;&nbsp;&nbsp;$tpl-&gt;assign(&quot;content&quot;, &quot;这是内容&quot;); <br/>&nbsp;&nbsp;&nbsp;&nbsp;$tpl-&gt;display(&#039;test.htm&#039;); <br/>?&gt; <br/><br/>7:在浏览器测试test.php显示为:<br/><br/>这是内容<br/><br/>恭喜,配置成功.否则,失败,再检查是不是按照我说的来的.<br/><br/><br/>Tips1 :为了能在网站全局使用Smarty技术,我们可以修改PHP.inc里面的<br/>&lt;B&gt;<br/><br/>; Windows: &quot;&#92;path1;&#92;path2&quot;<br/>include_path = &quot;.;c:&#92;php&#92;includes&quot;<br/><br/>&lt;/B&gt;<br/>改为:<br/>-------------------&gt;<br/><br/>; Windows: &quot;&#92;path1;&#92;path2&quot;<br/>include_path = &quot;.;c:&#92;php&#92;includes;d:&#92;web&#92;web&#92;php&#92;libs&quot;<br/><br/>使用模板的时候,像前面一样的方式使用,不要<br/><br/>include &quot;../libs/Smarty.class.php&quot;; <br/><br/>直接使用就行了的. 
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论]  [PHP]笑谈配置,使用Smarty技术]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>