zoukankan      html  css  js  c++  java
  • Smarty3.1.8 安装

     应用环境:Winsows7 IIS + PHP5.5.12 + Smarty3.1.8

     

    1. IIS 及 PHP 安装,参照《php手册》,这里不做细表。

    2. 假定应用目录为 C:inetpubwwwrootsmarty,解压缩Smarty3.1.8包,将libs文件夹拷贝至应用目录下;

    3. 在应用目录下新建一下几个文件夹:

        templates(用于存放模版的目录) 

        templates_c(用于存放编译后文件的目录) 

        cache(用于存放缓存的目录)

        config(用于存放配置的目录) 

    4. 设置应用目录的权限,允许当前用户对应用目录及其子文件/子文件夹的读写操作,Internet来宾帐户和启动IIS进程帐户两个帐户也要加上读写权限。(重要)

    5. 在应用目录下新建 smarty.php 文件,内容如下:

    <?php

        @require("libs/Smarty.class.php");

        $smarty = new smarty();

        $smarty->template_dir="templates";  //指定模版存放目录

        $smarty->compile_dir="templates_c";  //指定编译文件存放目录

        $smarty->config_dir="config";  //指定配置文件存放目录

        $smarty->cache_dir="cache";  //指定缓存存放目录

        $smarty->caching=false;  //关闭缓存(设置为true表示启用缓存)

        $smarty->left_delimiter="<{";  //指定左标签

        $smarty->right_delimiter="}>";  //指定右标签

    ?>

     

    6. 在templates文件夹下新建 index.tpl 模板文件,内容如下:

    <html>

    <head>

        <title>{$title}</title>

        <meta http-equiv="Content-Type" content="text/html;charset=gbk" />

    </head>

    <body>

        <span>你好,{$name}</span>

    </body>

    </html> 

     

    7. 在应用目录下新建 index.tpl 模板文件,内容如下:

    <?php

        @require("smarty.php");

        $smarty->assign('name','哈哈镜');

        $smarty->assign('title','smarty安装测试');

        $smarty->display('templates/index.tpl');

    ?>

     

    8. 访问http://localhost/smarty/index.php ,显示以下窗口说明安装完成:

    你好,哈哈镜

     

  • 相关阅读:
    遗忘
    2008年第一篇1.15
    键盘对应值
    油田开采基础知识
    最近
    oracle中lob数据的操作
    [转]大数据能做什么,大数据和云是不是一回事?
    [转]从这些方面判断一家公司的好坏
    This Android SDK requires Android Developer Toolkit version 20.0.0 or above
    谈创新
  • 原文地址:https://www.cnblogs.com/hamfy/p/3760506.html
Copyright © 2011-2022 走看看