search
HomeCMS TutorialECShopECSHOP introduces secondary development techniques

ECSHOP introduces secondary development techniques

Mar 10, 2021 am 10:56 AM
ecshopSecondary development

ECSHOP introduces secondary development techniques

Foreword: ECSHOP is a complete online store solution, including front-end product display, shopping process and powerful and easy-to-use back-end management. Because ecshop is simple and easy to use, users can almost have an online store system with a simple setup in 3 minutes. Therefore, many B2C sites have chosen to use the ECShop online store system, but sometimes we need to do something that ecshop does not have. function or front-end display, at this time we need to carry out secondary development of ecshop ourselves.

Recommended (free): ecshop

# #1. Secondary development of ecshop system functions

##The code structure of ecshop is very easy to understand. As long as you have a little PHP basics, you can modify it on the basis of the original program or function. Plug-in development.

Some public functions in ecshop will be placed in the includes folder, and almost all of these public functions can be used as a reference to easily create other functions we want. .

We need to carry out secondary development of ecshop. To put it simply, it is actually reading and writing operations on the database. So as long as we understand the database operation class of ecshop, the next implementation is very simple. Relaxed.

ecshop's database operation class is very powerful. Some commonly used functions are as follows:

1. Get a single record

$GLOBALS['db']->getRow($sql);


##2. Get a single field

$GLOBALS['db']->getOne($sql);


For example, query the total number of products:

echo $GLOBALS['db']->getOne(‘SELECT COUNT(*) FROM ‘ . $GLOBALS['ecs']->table(‘goods’) ;

##3. Get all records

$GLOBALS['db']->getAll($sql);

4. Execute sql statement

$GLOBALS['db']->query($sql);
//执行删除(DELETE),插入(INSERT),更新(UPDATE)等操作可用此方法

5. Insert array elements into the database

$parent['goods_number'] = ’1′;
$parent['parent_id'] = 0;
$GLOBALS['db']->autoExecute($GLOBALS['ecs']->table(‘cart’), $parent, ‘INSERT’);

#On this basis, you can easily carry out secondary development of ecshop.

2. Secondary development of ecshop front-end template

ecshop has a powerful template mechanism, which is implemented by ECSHOP combined with Dreamweaver It has a template mechanism. Changing the template no longer requires uploading, but can be done with a little effort in the background.

ecshop uses smarty template technology. Smarty is a template engine written in PHP and is currently one of the most famous PHP template engines in the industry. It separates logical code and external content, providing an easy-to-manage and use method to separate PHP code logic that is originally mixed with HTML code.

Use the assign method in the php file to pass the php variable value to the template file, for example:

$smarty->assign(‘action’, $action);
//把php中的变量$action传值给模板文件(*.dwt)中的’action’变量,模板文件可用{$action}来输出此值。

Use the display method to specify the current template file and output to the file to display to the client, for example:

$smarty->display(‘user_passport.dwt’);

More Free learning recommendation:

ecshop tutorial

The above is the detailed content of ECSHOP introduces secondary development techniques. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:CSDN. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.