﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>礁湖星云 &#187; PHP</title>
	<atom:link href="http://www.icyfire.me/tag/php-iprogram/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.icyfire.me</link>
	<description>太阳底下没有新鲜事。</description>
	<lastBuildDate>Tue, 31 Jan 2012 02:50:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>在Windows上安装Smarty</title>
		<link>http://www.icyfire.me/2008/01/%e5%9c%a8windows%e4%b8%8a%e5%ae%89%e8%a3%85smarty/</link>
		<comments>http://www.icyfire.me/2008/01/%e5%9c%a8windows%e4%b8%8a%e5%ae%89%e8%a3%85smarty/#comments</comments>
		<pubDate>Mon, 07 Jan 2008 15:05:53 +0000</pubDate>
		<dc:creator>icyfire</dc:creator>
				<category><![CDATA[杂物房]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.onlyif.cn/?p=47</guid>
		<description><![CDATA[Installing Smarty in Windows... <a href="http://www.icyfire.me/2008/01/%e5%9c%a8windows%e4%b8%8a%e5%ae%89%e8%a3%85smarty/">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h2>Installing Smarty in Windows</h2>
<p><span id="more-47"></span><br />
This document assumes that your webserver and php5 is running.</p>
<p>Download Smarty - <a href="http://smarty.php.net">http://smarty.php.net</a></p>
<p>Installation - <strong>Windows, IIS/Apache, PHP5</strong><br />
Extract files, rename Smarty.x.x.x to smarty (suggest OUTSIDE of your www root!)<br />
Example: d:\smarty<br />
Run phpinfo.php to find out your <strong>php.ini</strong> location<br />
Edit php.ini's include_path and add the location of the libs folder.<br />
example: <strong>include_path = &quot;.;d:\smarty\libs&quot;</strong><br />
Restart IIS/Apache<br />
Setup these two folders INSIDE your www root:<br />
<strong>(wwwroot)/smarty/templates</strong>  (this is where your templates will go)<br />
<strong>(wwwroot)/smarty/configs</strong></p>
<p>Setup these two folders OUTSIDE of your www root:<br />
<strong>d:/smarty/templates_c<br />
d:/smarty/cache</strong></p>
<p>Setup security settings for the webserver to write to these four folders</p>
<p>In (wwwroot) create index.php and in (wwwroot)/smarty/templates/index.tpl with the following code:</p>
<p><strong>index.php:</strong></p>
<pre lang="php"><?php

// load Smarty library
require('Smarty.class.php');

$smarty = new Smarty;

$smarty->template_dir = 'd:/inetpub/wwwroot/smarty/templates';
$smarty->config_dir = 'd:/inetpub/wwwroot/smarty/config';
$smarty->cache_dir = 'd:/smarty/smarty_cache';
$smarty->compile_dir = 'd:/smarty/smarty_templates_c';

$smarty->assign('name','fish boy!');

$smarty->display('index.tpl');
?></pre>
<p><strong>index.tpl</strong></p>
<pre lang="php"><html>
<body>
Hello, {$name}!
</body>
</html></pre>
<p>Now open index.php in your web browser (requested from your webserver)</p>
<p>http://webserver/index.php</p>
<p>You can work this out to a referenced script/class:<br />
<strong>smarty_connect.php:</strong></p>
<pre lang="php"><?php

// load Smarty library
require('Smarty.class.php');

class smarty_connect extends Smarty
{
   function smarty_connect()
   {
        // Class Constructor.
        // These automatically get set with each new instance.

		$this->Smarty();

		$this->template_dir = ' d:/inetpub/wwwroot/smarty/templates';
		$this->config_dir = ' d:/inetpub/wwwroot/smarty/config';
		$this->compile_dir = 'd:/smarty/templates_c';
		$this->cache_dir = 'd:/smarty/cache';

		$this->assign('app_name', 'Intranet');
   }
}
?></pre>
<p><strong>index.php:</strong></p>
<pre lang="php"><?php

require('smarty_connect.php');

$smarty = new smarty_connect;

$smarty->assign('name','Ned');

$smarty->display('index.tpl');
?></pre>
<p><strong>index.tpl:</strong></p>
<pre lang="php"><html>
<body>
 Hello, {$name}!
</body>
</html></pre>
<p>If you are getting an error that Smarty.class.php isn't found chances are that your include_path isn't correct or you didn't edit the one that the webserver is using, check your phpinfo.php!</p>
<hr />
This article is from:http://news.php.net/php.smarty.dev/2703<br />
Written by Jim Winstead</p>
]]></content:encoded>
			<wfw:commentRss>http://www.icyfire.me/2008/01/%e5%9c%a8windows%e4%b8%8a%e5%ae%89%e8%a3%85smarty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

