Create your message board with Smarty (1)

xiaoxiao2021-03-06  67

Let's talk about Smarty's configuration, please skip this part ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------- -------------

If you haven't smarty, please go to http://smarty.php.net download, the latest version is 2.6.3, download and decompressed, just copy the libs directory to your web root directory, then in the Web Directory Built a few subdirectory under:

Templates // Storage Template Templates_C / / Store compiled file configs // Storage Profile Cache // The above four is SMARTY needs to be set

In order to facilitate planning, build a few directory function // store custom function inc // stored head file JS // script file CSS // style sheet images // picture

In addition, the libs directory except the Smarty class, you can also put the class yourself in this, which is convenient for planning.

The following is the settings in the file, save this file in the Inc directory for call

Require ("./ Libs / Smarty.class.php"); $ smarty = new smarty, PHP ();

/ / -------------------------------------------------------------------------------------------- ------------------------------ // Specify the function directory (template, compile, configure, cache) // -------------------------------------------------- -------------------------- $ Smarty -> Templatfe_dir = './Templates'; $$./templates_dir =' ./templates_c '; $ Smarty -> config_dir = './configs'; $$./cache';//$smarty -> caching = true; // $ smarty -> cache_lifetime = 300; // -------- -------------------------------------------------- ------------------------- // Template boundary symbol setting, mainly to prevent label conflict // ---------- -------------------------------------------------- ------------------- $ smarty -> left_delimiter = '<{'; $ smarty -> right_delimiter = '}>';

/ / -------------------------------------------------------------------------------------------- ------------------------------- // Shared template variables // ----------- -------------------------------------------------- ------------------ $ Smarty -> Assign ('Banner', 'Images / Banner.jpg');

?>

(to be continued)

转载请注明原文地址:https://www.9cbs.com/read-120139.html

New Post(0)