Destoon is the preferred solution for open-source B2B (e-commerce) industry portal based on PHP + MySQL. This article briefly describes the secondary development of Destoon as follows:
I. initialize the system
The system can be initialized using common. inc. php In the root directory of the system.
For example, to create a hello. php file under the root directory of the site, the Code is as follows:
<?phprequire 'common.inc.php';echo 'Hello World';?>
Ii. Write Logic
After the system is initialized, you can write logic code in the PHP file and call the built-in variables, functions, and classes of the system.
The sample code is as follows:
<? Phprequire 'common. inc. php'; echo DT_ROOT; // physical path of the output site echo '<br/>'; echo DT_PATH; // echo '<br/>' on the homepage of the output site '; $ r = $ db-> get_one ("SELECT * FROM {$ DT_PRE} category"); // query a piece of data print_r ($ r) FROM the category table ); // print the read data $ A = cache_read ('area. php '); // read the system's regional cache print_r ($ A); // print the read data print_r ($ MODULE ); // print the system module data message ('Hello World'); // output a message?>
3. Application Template
All HTML output to the browser is displayed through the rules in the template.
Usage:
include template('a', 'b');
Parameter a indicates the Template Name.
Parameter B indicates the directory where the template is stored. This parameter can be left unspecified.
If the template directory is default, then:
Template ('A', 'B'); represents the template/default/B/a.htm template File
Template ('A'); represents the template/default/a.htm template File
The sample code is as follows:
<?phprequire 'common.inc.php';template('hello');?>
In addition, the template/default/hello.htm template file must be created in advance.