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:
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Linux new version
SublimeText3 Linux latest version

Atom editor mac version download
The most popular open source editor

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Mac version
God-level code editing software (SublimeText3)





