..真实国产乱子伦毛片,亚洲激情五月丁香,欧美福利网,天天干天天日B

  • 歡迎訪問秦皇島網(wǎng)絡公司-炎黃科技 | QHDSUDU.COM
  • 今天是:2025 年 05 月 10 日 網(wǎng)站已經(jīng)正常運行 [7615] 天
信息講堂

php超強模板引擎smarty簡單配置

字號:     2011-08-01 14:14:59   來源:炎黃科技   上一條    下一條
1.從從smarty官網(wǎng)下載smarty,然后解壓到根目錄。
2.將全部解壓的文件其中一個libs目錄拷貝到根目錄下面。里面是smarty用到的類。
3.新建三個文件夾
    cache —— 緩存文件夾
    templates —— 模板文件夾
    templates_c —— 模板編譯文件夾
4.在網(wǎng)站根目錄下面創(chuàng)建配置文件,建立smary_config.php,在其中輸入如下代碼:
    include_once ("libs/Smarty.class.php"); //包含smarty文件
    $smarty = new Smarty(); //建立實例對象
    $smarty->config_dir="libs/Config_File.class.php"; //目錄變量
    $smarty->caching = false; //是否使用緩存
    $smarty->template_dir="./templates"; //設置模板目錄
    $smarty->compile_dir="./templates_c"; //設置模板編譯目錄
    $smarty->cache_dir="./smarty_cache";//緩存文件夾
    $smarty->left_delimiter="<{"; $smarty->right_delimiter="}>";
5.templates 目錄下建立index.html文件,內(nèi)容如下:
    <html >
    <head>
    <title>({$title}) </title>
    <meta http-equiv=”Content-type” content=”text/html; charset=utf-8″>
    <META NAME=”Author” CONTENT=”">
    <META NAME=”Keywords” CONTENT=”">
    <META NAME=”Description” CONTENT=”">
    </head>
    <body>
    ({$title})<p />
    ({$content})
    </body>
    </html> 
6.在根目錄下建立index.php文件,內(nèi)容如下: 
    <?php
    assign("title", "測試成功了,這是標題");
    $smarty ->assign("content", "這是內(nèi)容");
    $smarty->display(index.html);
    ?>
7.如果沒有什么意外發(fā)生,瀏覽器中打開index.php 基本配置已經(jīng)成功。

秦皇島網(wǎng)絡公司聯(lián)系電話
致電 137 859 36100
7×24小時服務熱線
秦皇島網(wǎng)絡公司工作時間
在線咨詢
每工作日 9:00-17:30
點擊進入>
預約秦皇島網(wǎng)站制作專家
預約專家
為您提供一對一解決方案
點擊進入>
秦皇島網(wǎng)絡公司的地圖位置
地圖位置
在地圖上看我們的位置
點擊進入>
秦皇島網(wǎng)絡公司官方微博
訪問官方微博
唯一官方微博平臺
點擊進入>
版權所有 ? 2010-2011 秦皇島網(wǎng)絡公司 秦皇島網(wǎng)站制作
Copyright ? 2010-2011 Qhdsudu.com All Rights Reserved 冀ICP備13009153號-13
聯(lián)系電話:13785936100  電子郵箱:1514969798@qq.com
微信溝通 QQ客服
掃描二維碼添加客服微信