Getting Started with destoon Secondary Development Sample

  • 2021-07-01 06:58:45
  • OfStack

Destoon is the preferred solution for the open source B2B (e-commerce) industry portal based on PHP+MySQL. This article briefly describes the two developments of Destoon as follows:

1. Initialize the system

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

For example, create an hello. php in the root directory of the site with the following code:


<?php
require 'common.inc.php';
echo 'Hello World';
?>

STEP 2 Write logic

After system initialization, you can write logic code in php file, and you can also call variables, functions and classes built in the system.

The sample code is as follows:


<?php
require 'common.inc.php';
echo DT_ROOT;// The physical path of the output site 
echo '<br/>';
echo DT_PATH;// Home page address of output site 
echo '<br/>';
$r = $db->get_one("SELECT * FROM {$DT_PRE}category");// Query from the classification table 1 Bar data 
print_r($r);// Print the read data 
$A = cache_read('area.php');// Read the system's locale cache 
print_r($A);// Print the read data 
print_r($MODULE);// Print system module data 
message('Hello World');// Output 1 Segment prompt information 
?>

3. Apply the template

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

Usage:


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

The parameter a represents the template name
Parameter b indicates the directory where the template is stored. This parameter can not be set

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:


<?php
require 'common.inc.php';
template('hello');
?>

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


Related articles: