Home  >  Article  >  Backend Development  >  destoon secondary development introductory example tutorial

destoon secondary development introductory example tutorial

WBOY
WBOYOriginal
2016-07-25 09:11:591782browse

destoon secondary development introductory example tutorial

Destoon is the preferred solution for open source B2B (e-commerce) industry portals based on PHP+MySQL.

This article briefly describes the secondary development of Destoon as follows: 1. Initialization system Including common.inc.php in the system root directory can initialize the system. For example, create a hello.php in the root directory of the site with the following code:

  1. require 'common.inc.php';
  2. echo 'Hello World';
  3. ?>
Copy code

2. Write logic After the system is initialized, you can write logic code in the php file, and you can also call the system's built-in variables, functions and classes. example:

  1. require 'common.inc.php';
  2. echo DT_ROOT;//Output the physical path of the site
  3. echo '
    ';
  4. echo DT_PATH;//Output the site Home page address
  5. echo '
    ';
  6. $r = $db->get_one("SELECT * FROM {$DT_PRE}category");//Query a piece of data from the category table
  7. print_r($ r);//Print the read data
  8. $A = cache_read('area.php');//Read the system's area cache
  9. print_r($A);//Print the read data
  10. print_r($MODULE );//Print system module data
  11. message('Hello World');//Output a prompt message
  12. ?>
Copy code

3. Application template All HTML output to the browser is displayed through the rules in the template. Instructions:

  1. include template('a', 'b');
Copy code

Parameter a represents the template name Parameter b represents the directory where the template is stored. This parameter does not need to be set. If the template directory is default, then: template('a', 'b'); represents template/default/b/a.htm template file template('a'); represents template/default/a.htm template file example

  1. require 'common.inc.php';
  2. template('hello');
  3. ?>
Copy code

In addition, template/default/hello.htm template The file needs to be created in advance.

Recommended reading: destoon introductory tutorials and skill examples


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn