Discuz wrapper class code for template Discuz template engine

Source: Internet
Author: User
Main function Description
Removed the functionality of the Discuz language pack
Porting all of the features in the Discuz template
Added automatic Update cache and lifecycle features
The use of the template in the same way as discuz, so do not make redundant instructions, before use only need to do some simple setup to
If you need to use Discuz's Language pack feature, just remove the template.class.php 172th comment and add discuz original Languagevar function in template.func.php.
Click to download the source file
Here's the code example:
/**
* Use Example
*
* @copyright Copyright (c) 2007-2008 (http://www.tblog.com.cn)
* @author Akon (tomato red)
* @license PHP Version 3.0 {@link Http://www.php.net/license/3_0.txt}
*/
Require_once (' classes/template.class.php ');
$options = Array (
Template_dir ' = ' templates/',//Specify template file to store directory
' Cache_dir ' = ' templates/cache ',//Specify cache file storage directory
' Auto_update ' + true,//regenerate cache when template file is changed [close this item will be faster]
' Cache_lifetime ' = 1,//Cache life cycle (minutes), 0 = permanent [set to 0 faster]
);
$template = Template::getinstance (); Instantiating a template class using a single-piece pattern
$template->setoptions ($options); Setting Template Parameters
/*
You can set parameters using the following three ways
$template->setoptions (Array (' template_dir ' = ' templates/default/')); Used for Batch setup
$template->set (' Template_dir ', ' templates/default/');
$template->template_dir = ' templates/default/');
*/
$TESTARR = Array (' testa ' = ' a ', ' testb ' = ' B ');
Include ($template->getfile (' test.htm '));
?>

The above describes the Discuz template Discuz template engine encapsulation class code, including the content of the Discuz template, I hope to be interested in PHP tutorial friends helpful.

  • Related Article

    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.