Hướng dẫn Cài đặt Smarty template trên môi trường UNIX đơn giản và nhanh chóng.
Cài đặt SMARTY LIBRARY
Copy các file thư viện Smarty vào
/usr/local/lib/php/Smarty/
$> cd YOUR_DOWNLOAD_DIRECTORY
$> gtar -zxvf Smarty-2.6.7.tar.gz
$> mkdir /usr/local/lib/php/Smarty
$> cp -r Smarty-2.6.7/libs/* /usr/local/lib/php/Smarty
Ta có các file và cấu trúc thư mục như sau:
/usr/local/lib/php/Smarty/
Config_File.class.php
debug.tpl
internals/
plugins/
Smarty.class.php
Smarty_Compiler.class.php
Cài đặt SMARTY DIRECTORIES
You will need four directories setup for Smarty to work. These files are for
templates, compiled templates, cached templates and config files. You may or
may not use caching or config files, but it is a good idea to set them up
anyways. It is also recommended to place them outside of the web server
document root. The web server PHP user will need write access to the cache and
compile directories as well.
In our example, the document root is /web/www.domain.com/docs and the
web server username is "nobody". We will keep our Smarty files under
/web/www.domain.com/smarty
$> cd /web/www.domain.com
$> mkdir smarty
$> mkdir smarty/templates
$> mkdir smarty/templates_c
$> mkdir smarty/cache
$> mkdir smarty/configs
$> chown nobody:nobody smarty/templates_c
$> chown nobody:nobody smarty/cache
$> chmod 775 smarty/templates_c
$> chmod 775 smarty/cache
SETUP SMARTY PHP SCRIPTS
Now we setup our application in the document root:
$> cd /web/www.domain.com/docs
$> mkdir myapp
$> cd myapp
$> vi index.php
Edit the index.php file to look like the following:
<?php
// put full path to Smarty.class.php
require('/usr/local/lib/php/Smarty/Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir = '/web/www.domain.com/smarty/templates';
$smarty->compile_dir = '/web/www.domain.com/smarty/templates_c';
$smarty->cache_dir = '/web/www.domain.com/smarty/cache';
$smarty->config_dir = '/web/www.domain.com/smarty/configs';
$smarty->assign('name', 'Ned');
$smarty->display('index.tpl');
?>
SETUP SMARTY TEMPLATE
$> vi /web/www.domain.com/smarty/templates/index.tpl
Edit the index.tpl file with the following:
<html>
<head>
<title>Smarty</title>
</head>
<body>
Hello, {$name}!
</body>
</html>
Now go to your new application through the web browser,
http://www.domain.com/myapp/index.php in our example. You should see the text
"Hello Ned!" in your browser.
Once you get this far, you can continue on to the Smarty Crash Course to learn
a few more simple things, or on to the documentation to learn it all.
Nguồn sưu tầm
| Hướng dẫn cài đặt Smarty Template engine trên Windows < Lùi | Tiếp theo > Cấu hình file .htaccess để thêm Addon Domain |
|---|
Tin mới hơn:
- 20/04/2009 22:43 - Thư viện đồ họa GD Library
- 19/04/2009 13:43 - Cài đặt Web Server XAMPP trên Linux
- 09/04/2009 18:12 - Thiết kế web với các kiểu Menu, Tab CSS, jQuery
- 04/04/2009 20:49 - Ứng dụng swfobject để thể hiện Flash media: video, music, flash, flv
- 04/03/2009 22:46 - Hướng dẫn cài đặt Smarty Template engine trên Windows
Tin cũ hơn:
- 28/02/2009 23:07 - Cấu hình file .htaccess để thêm Addon Domain
- 27/02/2009 11:06 - Một số bảng mã thông dụng
- 10/01/2009 20:34 - Làm thế nào để thiết kế lại trang web của bạn
- 05/01/2009 08:13 - Giới thiệu các dịch vụ dùng để tạo trang web bắt đầu - StartPage
- 04/01/2009 14:32 - Miễn phí download các bộ Icon đang nóng nhất hiện nay !
Download Game bóng đá PES8 Việt Nam
Tải game bóng đá FiFa 09
Tải game Dragon ball Z - 7 viên ngọc rồng
Tải Game Bóng Đá Pro Evolution Soccer 6 Việt Nam
Download PES 2011 patch Việt Nam PESVN
Tải Game Bóng Đá FIFA 2009 RIP 1 CD
Download Pro Evolution Soccer 2011
Download Game THE SIMS 3
Tải Game bóng đá PES 2009
Download PES 2011 demo
Thay đổi màn hình đăng nhập Windows 7 bằng tay
Một số hàm hay dùng trong JavaScript
Kiểm soát hoàn toàn trỏ chuột bằng bàn phím với NeatMouse
Choáng với concept của Windows Phone 8
Những đặc điểm ưu việt của Windows Phone
Ứng dụng gọi điện VoIP Viber sắp có mặt trên Windows Phone
Game Diablo 3 sắp có mặt trên Windows Phone Marketplace
37 trang css & xhtml web template miễn phí tuyệt đẹp
Những điều cơ bản cần biết về bàn phím chơi game - Gaming Keyboard
L.A. Noire: The Complete Edition - THETA [Full ISO/Action/2011] [13.37GB]
Download 7554 demo
Download Game PC, cập nhật liên tục (torrent)
PES 2012 ra mắt bản mở rộng đầu tiên vào 11/10
PES2012 - Full version - Ngôn ngữ và bình luận tiếng Anh
PES2012 - Blurry disable làm mịn đồ họa
PES 2011 PATCH 4.1 - TRANSFER UPDATE - RELEASED
Bộ sưu tập free PrestaShop Themes phần 3
Bộ sưu tập theme Prestashop miễn phí phần 2
Top 10 Free PrestaShop Themes
Download Prestashop 1.5
Download PrestaShop 1.4
Bổ sung Memcached vào PrestaShop 1.4
Hướng dẫn tích hợp Ngân Lượng vào PrestaShop
Sửa lỗi invalid carrier or no carrier selected trong PrestaShop
Cài đặt PrestaShop
Thiết kế giao diện PrestaShop Theme
Hướng dẫn cài đặt themes trong PrestaShop
Hướng dẫn cách thêm ngôn ngữ cho PrestaShop
Bộ sưu tập Giao diện Premium PrestaShop Themes chuyên nghiệp
Giới thiệu về website thương mại điện tử 2.0 Prestashop
Cấu hình đường dẫn thân thiện với Joomsef


