First, Smarty installed in the configuration file

Source: Internet
Author: User

Install the library file in the/libs/directory of the Smarty release (just unzip it). These PHP files you can not doodle Oh. These files are shared by all applications and can only be updated when you upgrade to the new version of Smarty. Smarty Manual Example 2-1.smarty library file smarty.class.phpsmarty_compiler.class.phpconfig_file.class.phpdebug.tpl/core/*.php (all of them)/plugins/*.php (all of them) SMARTY uses a PHP constant called ' smarty_dir ' as its system library directory. Basically, if your application can find the Smarty.class.php file, you don't need to set up Smarty_dir,smarty will work on its own. However, if Smarty.class.php is not in your include_path (a setting in php.ini), or if you do not set its absolute path in your application, you must manually configure Smarty_dir (most programs do) The smarty_dir must contain a trailing slash. Here is an example of a Smarty application you create in your PHP script: require (' Smarty.class.php '); $smarty = new Smarty; Try running the above script if you find " You should do this when you do not find the Smarty.class.php file "error: Smarty manual example 2-3. Add the absolute path to the library file directory require ('/usr/local/lib/php/smarty/ Smarty.class.php '); $smarty = new Smarty; Smarty Handbook Example 2-4. In include_path Add library files directory//Edit your php.ini file, add the Smarty library//directory to the Include_path and R Estart Web server.//then the following should Work:require (' Smarty.class.php '); $smarty = new Smarty; SMARTY Handbook Example 2-5. Manually set Smarty_dir constant define (' Smarty_dir ', '/usr/local/lib/php/smarty/'); require (smarty_dir. ' Smarty.class.php '); $smarty = new Smarty; Now that the library file is done, it's time to set up a directory for your application to configure other Smarty. Smarty requires 4 directories, which are named by default: Tempalates, Templates_c, configs and cache. Each can be customized to modify the Smarty class properties: $template _dir, $compile _dir, $config _dir, and $cache _dir respectively. It is highly recommended that you set up a single directory for each application that uses Smarty! Make sure you already know your Web server file root directory. In our example, the file root directory is: "/web/www.mydomain.com/docs/" Smarty 4 directories can only be accessed by those library files, can not be accessed by browsers on the network directory. Therefore, in order to avoid any security problems, the 4 directory and Web page file directory (which is the browser) is required to separate.

  

First, Smarty installed in the configuration file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.