马永占,myz,mayongzhan

相当稳定的进步,欢迎回贴交流

马永占ID:mayongzhan
65233次访问,排名1535(1)好友1人,关注者14
php,apache,mysql,linux,html,css,javascript
mayongzhan的文章
原创 150 篇
翻译 0 篇
转载 0 篇
评论 89 篇
myz的公告

XML聚合
feedsky
最近评论
790500:马永占,你好,请加我QQ790500,我想做个小软件,是关于登陆论坛的
joe:Zend_Acl 每个人理解不同,我开始用zf做项目,权限也是自己写,后来全部重写为Zend_Acl,因为个人觉得Zend_Acl和Zend_Auth结合用不错

Zend_Filter 虽然我写的model底层类的那些基本的过滤都是直接用php函数,毕竟速度快,也方便,但这个只是基础,很多时候不同表单牵涉不同的过滤,例如ip地址过滤等等,那么就需要自己写filter了,……
nginxlee:很好,很强大!
Henry_Ma:这个笔记不错,我也这样记一下。
ZXS:收藏!
文章分类
收藏
    相册
    存档
    订阅我的博客
    XML聚合  FeedSky

    原创 smartyquickstart中文收藏

    新一篇: apache+php+mysql+phpmyadmin规范安装补充 | 旧一篇: ->,self,$this的区别

    版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出版、作者信息和本声明。否则将追究法律责任。http://blog.csdn.net/mayongzhan - 马永占,myz,mayongzhan 

    官方的quickstart windows版的是英文的,刚试了下,顺便翻译了一下,并改了点东西,测试能正常运行。
    红色字部分是每个人不同的,需要注意。
     
    ---------------------------------------------------------------------
    Windows下安装 Smarty
     
    前提:服务器和php已经安装好并可以正常运行。
     
    下载 Smarty - http://smarty.php.net
     
    解压文件, 重命名 Smarty.x.x.x 为 smarty (出于方便,建议不要把文件放在服务器目录下) 
    例如: d:\smarty
    运行 phpinfo.php 找到 php.ini 文件的位置
    编辑 php.ini的 include_path ,加入smarty的libs的路径。
    例如: include_path = ".;d:\smarty\libs"
    重启 IIS/Apache
    在服务器目录下创建下面两个文件夹:
    (wwwroot)/smarty/templates (模板以后放在这里)
    (wwwroot)/smarty/configs
     
    在非服务器目录下创建下面两个文件夹:
    d:/smarty/templates_c
    d:/smarty/cache (这个我目前根据本文的测试,没有用)
     
    设置系统,保证这四个文件是可写的。
     
    在 (wwwroot) 建立 index.php 然后建立 (wwwroot)/smarty/templates/index.tpl ,代码如下:
     
    index.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/cache';
    $smarty->compile_dir = 'd:/smarty/templates_c';
     
    $smarty->assign('name','fish boy!');
     
    $smarty->display('index.tpl');
    ?>
     
    index.tpl
    <html>
    <body>
    Hello, {$name}!
    </body>
    </html>
     
    现在在浏览器中打开 index.php
     
     
    上面是一个简单的例子,下面建立一个使用class的例子:
    smarty_connect.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');
       }
    }
    ?>
     
    index.php:
    <?php
     
    require('smarty_connect.php');
     
    $smarty = new smarty_connect;
     
    $smarty->assign('name','Ned');
     
    $smarty->display('index.tpl');
    ?>
     
    index.tpl:
    <html>
    <body>
     Hello, {$name}!
    </body>
    </html>
     
     
    如果出现错误,请察看php.ini文件是否有错误,include是否正确。
      
    注:我自己是把config templates templates_c都放到服务器目录下了,而且没有建立cache文件夹,程序正常运行。
     
     

    发表于 @ 2007年06月19日 22:14:00|评论(loading...)|编辑

    新一篇: apache+php+mysql+phpmyadmin规范安装补充 | 旧一篇: ->,self,$this的区别

    评论:没有评论。

    发表评论  


    登录
    Csdn Blog version 3.1a
    Copyright © myz