Ectouch Second lecture on the structure of documents

Source: Internet
Author: User

I believe that everyone in the Ectouch official website have noticed, Ectouch use of the MVC framework, has been thought it used and ecshop like smarty, the bird silently according to the Smarty file structure study for several days, the result is a variety of documents on the number. Helpless under asked degree Niang only understand my thinking from the beginning is a mistake (sister's, so simple mistake, I actually really so seriously study for a few days, is also drunk, we usually still more with degrees Niang communication, don't and I just met a problem sitting there thinking ... )。 That's enough, it's time to get to the chase.

First talk about the MVC structure, I believe that we can find a lot of information on the Internet, here is a brief summary of Ectouch documents.

module (the model): M

The function file suffix that is mainly used to manipulate the database is usually the ***model.class.php path. /mobile/include/apps/default/model/

Controller: C

The controller is the first station for all Web applications, accepting parameters such as $_get variables, and then reacting accordingly. The function file suffix that mainly contains the processing user various actions is generally ***controller.class.php path is generally: /mobile/include/apps/default/controller/

view: That is, v

When it comes to views, many of us will think of template engines (such as smarty, etc.). In fact, there are all kinds of output, such as HTML templates and JavaScript files. The template path is generally: /mobile/themes/default/

Directory structure

root directory
| –admin Default Admin directory (can be renamed)
| –data static resources and system caches, configuration entries (must be writable)

| –assets Static Resource Directory

| –attached Accessories Catalogue

| –cache Cache Directory
| –common public static file directory
| –include Core Program Directory

| –apps Main Program
| –admin Backend Module

| –install Mounting Module

| –default front-Desk Default module
| –common Public methods

| –controller Controller

| –language Language Pack

| –model model
|  –base Basic Program |  –constant.php System Constants |  –function.php System Functions |  –controller | –model

| –driver drivers

| –library Main class Library

| –vendor third-party extension classes

| –plugins plug-in program directory

| –connect Authorized Login

| –wechat
| –integrates third-party user integration
| –payment Payment Method

| –shipping Delivery Method

| –themes system default Template directory

URL structure

Ectouch is developed using an MVC design pattern, accessed based on modules and operations, and uses a single entry mode for project deployment and access, with access to any function and module, only through this portal file.

Module access method [Example]: index.php?m=default&c=category&a=index&id=2

which
m = Default is the module name in include/apps/

C = Category for controller name in include/apps/default/controller/indexcontroller.class.php

A = Index Controller access method name is located in include/apps/default/controller/indexcontroller.class.php Index () method

id = 2 is the same as the normal get pass parameter for other parameters
Modules and Operating methods
The modules in Ectouch, which are located in the include/apps/directory, are called a module in each directory. That is, m in URL access [Example]:

Index.php?m=default&c=index
Then you are visiting the Ectouch/include/apps/default module.
If you create a foreground module, just create it in the Include/apps/default directory: module name +model.class.php
Controller
The controller is the class file under Controllers under the module file, located under the include/apps/module/controller/.

The naming convention is: file name +controller.class.php, the file name begins with uppercase letters, such as a controller named Test, then his name is TestController.class.php. The class name of the controller class must be the same as the controller filename.
If you create a TestController.class.php under the default module, then we enter the URL in the browser:
Http://localhost/ectouch/mobile/index.php?m=default&c=test can be accessed to the appropriate controller

If you add a controller class that inherits other classes, be aware that the method name in your class cannot duplicate the method name of the parent class, or it overwrites the original or the program run error occurs.

For example, the class of the default module inherits the Commoncontroller class, and the view method is defined in this class, so the method cannot be defined again.
Naming conventions
The specifications are as follows:
The class file for the core program directory (includes) needs to have a. class.php suffix name, with the first letter capitalized. Example: IndexModel.class.php
The class name and file name in the controller and model match, for example, the class name of IndexModel.class.php is: Indexmodel

Ectouch Second lecture on the structure of documents

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.