TAILIEUCHUNG - Học php, mysql và javascript - p 30

Điều đó được Smarty cài đặt, nhưng bạn cũng cần phải tạo ra bốn thư mục con cho mỗi ứng dụng sử dụng nó. Vì vậy, tạo ra các ứng dụng tạm thư mục mới ngay dưới gốc tài liệu cùng một nơi mà bạn chỉ cần cài đặt Smarty. Điều này sẽ tổ chức các tập tin cho một ứng dụng tạm thời mà chúng ta sẽ viết để kiểm tra Smarty. | That gets Smarty installed but you also need to create four subdirectories for every application that uses it. So create the new application directory temp just under the same document root where you just installed Smarty. This will hold the files for a temporary application that we ll write to test Smarty. Inside the temp directory create another one called smarty to house the folders containing the template files. Finally create the following subdirectories within the new smarty directory cache config templates and templates_c. Your directory structure is now temp smarty cache config templates templates_c Creating Scripts You are now ready to create some Smarty scripts. Type in the code in Example 12-1 and save it as . Example 12-1. The program php path _SERVER DOCUMENT_ROOT require path Smarty smarty new Smarty smarty- template_dir path temp smarty templates smarty- compile_dir path temp smarty templates_c smarty- cache_dir path temp smarty cache smarty- config_dir path temp smarty configs smarty- assign title Test Web Page smarty- display path temp This program tells Smarty where it can find the file and where your Smarty templates are located. Because we will be using both .php and .tpl template files in this chapter I have included everything you need in each file. Example 12-1 looks up the document root and sets the variable path to that value. It then uses path as a prefix for fetching the Smarty class files and the template files from the temp folder. This saves you the maintenance hassle of hard-wiring full path names into the code. Creating Scripts 271 Note the penultimate smarty- assign command. This creates a Smarty variable called title and assigns it the string value Test Web Page . You ll see why shortly. Once you have typed the program in save it using the filename into the temp directory you created earlier. Creating .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.