发新话题
打印

我在D4PHP中为什么不能使用smarty模板功能?

我在D4PHP中为什么不能使用smarty模板功能?

提示$compile_dir '/tmp' 不存在或者不是一个文件夹~ 可是我这是看着视频教程做的啊,难道还需要其他什么设置吗?>> 请告之啊~

我在测试目录下 新建一个 tmp文件夹也不行,文件夹是可写的~
请高手帮忙解决一下啊~ 谢谢哈

TOP

Here is a very short article about using/creating smarty templates:
http://www.qadram.com/vcl4php/index.php?ac=1400

Here is a great article titled: Smarty Templates For Beginners
http://www.morningcaffeine.com/2007/01/21/smarty-templates-for-beginners/

I remember stumbling across a web page yesterday that showed you very basically how to use smarty in Delphi for PHP, but I cannot seem to find that page now

I'll have a hunt around later on today and see what I can find. Unless anyone else has some examples???
一個偽裝成白癡的天纔!

TOP

You can download an exmaple project for Delphi4PHP here:
http://cc.codegear.com/Item/24527
一個偽裝成白癡的天纔!

TOP

谢谢哈~~
我先看看,如何搞定这个~~

TOP

http://www.qadram.com/vcl4php/index.php?ac=1400
这个页面我打的时候,非常的慢~
而这个页面http://www.morningcaffeine.com/2 ... ates-for-beginners/,貌似对我没有什么用~ 因为在D4PHP中,我不知道该如何设置smarty的目录,按照书说的设置到 网站下面,可怎么也不行啊~ ???

TOP

这个问题,我已经解决,原因出在,这是D4PHP的一个BUG,D4PHP本意或许是用在liux或其他非win系统上来解决问题的,用在windows系统下,就有可能在使用smarty的时候出现找不到 /tmp 文件~
一个解决的方法: 修改vcl目录下的smartytemplate.inc.php文件~
在 function initialize() 中找到如下一句:
    $this->_smarty->compile_dir = '/tmp';

改成如下即可:

if ( preg_match( "/^WIN/i", PHP_OS ) )
                 {
                     if ( isset( $_ENV['TMP'] ) )
                     {
                         $this->_smarty->compile_dir = $_ENV['TMP'];
                     } elseif( isset( $_ENV['TEMP'] ) ) {
                         $this->_smarty->compile_dir = $_ENV['TEMP'];
                     } else {
                         $this->_smarty->compile_dir = 'C:\TEMP';
                     }
                 } else {
                     $this->_smarty->compile_dir = '/tmp';
                 }

其中的C:\TEMP 文件夹,可以随意自行定义~~

TOP

另一个简单的解决方法

可以将编写的PHP文件保存到D4P的程序所在目录中,即可解决。

TOP

发新话题