Home >Backend Development >PHP Tutorial >Destoon secondary development entry example_PHP tutorial

Destoon secondary development entry example_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:24:20934browse

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:

1. Initialization system

Include common.inc.php in the system root directory to initialize the system.

For example, create a hello.php in the root directory of the site, the code is as follows:

<&#63;php
require 'common.inc.php';
echo 'Hello World';
&#63;>

2. Writing 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.

The sample code is as follows:

<&#63;php
require 'common.inc.php';
echo DT_ROOT;//输出站点的物理路径
echo '<br/>';
echo DT_PATH;//输出站点的首页地址
echo '<br/>';
$r = $db->get_one("SELECT * FROM {$DT_PRE}category");//从分类表里查询一条数据
print_r($r);//打印读取的数据
$A = cache_read('area.php');//读取系统的地区缓存
print_r($A);//打印读取的数据
print_r($MODULE);//打印系统模块数据
message('Hello World');//输出一段提示信息
&#63;>

3. Application Template

All HTML output to the browser is displayed through the rules in the template.

How to use:

include template('a', 'b');

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

The sample code is as follows:

<&#63;php
require 'common.inc.php';
template('hello');
&#63;>

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825493.htmlTechArticleDestoon 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 includes...
in the system root directory
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