Research Ecmall Some process, structure notes (RPM)

Source: Internet
Author: User

index.php
Ecmall::startup ()//ecmall.php

Object//base class for all classes ecmall.php
Baseapp//Controller base class app.base.php
Ecbaseapp//ecapp.base.php
Frontendapp//Front Controller base class frontend.base.php
Mallbaseapp//Marketplace Controller base class frontend.base.php
default.app.php//Above class is the parent class of the Defaultapp class

The root directory represents @ (in this expression wwwroot/ecmall)
@index. PHP (index.php file under root directory, i.e. wwwroot/ecmall/index.php)


@index. PHP (load config file config.inc.php and core file ecmall.php)
=>ecmall::startup ();
=>ecmall.php
=>startup ();
=>require (Root_path. ' /app '. " /{$app}.app.php ");(load Controller, default is default.app.php)
=>do_action ();(D Methods of the Efaultapp class)
=>default.app.php
=>do_action ();(d o_action in the parent class Frontendapp of the parent class Ecbaseapp, Defaultapp parent Mallbaseapp,
Where class Mallbaseapp and class Frontendapp are in the frontend.base.php file, the Ecbaseapp class is in the ecapp.base.php file)
=>parent::d o_action ();(is the member function do_action () of the parent class Baseapp of the Class Ecbaseapp (not a static member, if the static member parent is changed to a class name),
Where the Baseapp class is in the app.base.php file)
=>_run_action ();
+ $this $action ();($action = $this->_curr_action, which is equal to index)





deault.app.php (Defaultapp Class)
=>index ();
= = $this =>assign ();
=>app.base.php (Baseapp Class)
=>assign ();
=>_init_view ();
= = $this->_view=& v ();
=>ecmall.php (object Class)
=>& V ();(loaded with/eccore/view/template.php,ecstemplate Class)
=>app.base.php (Baseapp Class)
= = $this->_view->assign ();(at this time $this->_view is an instance of the Ecstemplate class)
=>template.php (Ecstemplate Class)
=>assign ();
= $this->_var[$key]= $val;


> default.app.php (Defaultapp Class)
=>display ()
=>frontend.base.php
=>display ()


SEO (ie title,description,keywords)
$this->_config_seo (Array (' title ' = ' ... ',...)); /Set the title tag
=>ecapp.base.php (Ecbaseapp Class)
=>_config_seo ();
=>_assign_seo ();
=>_get_seo_code ();//Generate HTML code, such as $html.= "<{$type}>{$info}</{$type}>";





frontend.base.php (Frontendapp class, line 17-18)
Load the lang configuration file,
Lang::load (Lang_file (' common));
The configuration for each app is loaded
Lang::load (Lang_file (APP));
Ecmall.php ()
=>lang_file (); Root_path. '/languages/'. Lang. ‘/‘ . $file. '. lang.php ';(config.inc.php ' lang ' = ' sc-utf-8 ')
ecapp.base.php (Ecbaseapp Class)
= = Loaded with the Conf configuration in line 114,conf::load ($setting->getall ());



Initialization direction
Ecmall.php (122,require ($app _file, e.g. default.app.php))
=>default.app.php (Defaultapp Class)
=>frontend.base.php (class Mallbaseapp and class Frontendapp)
=>mallbaseapp
=>frontendapp
Lang::load (Lang_file (' common '));
Lang::load (Lang_file (APP));
=>ecapp.base.php (Ecbaseapp Class)
=>ecbaseapp
$setting =af ();/includes/arrayfile.base.php and/include/arrayfiles/$type (for example, settings) are loaded. arrayfile.php
$setting->getall (), implemented _loadfromfile () in settings.arrayfile.php Get_default () and arrayfile.base.php;
$this->_init_visitor ();(Line116) (but the member function of the Frontendapp class in frontend.base.php was executed _init_visitor (), followed by
Class Uservisitor in frontend.base.php and class Basevisitor related in ecapp.base.php)
=>app.base.php (Baseapp Class)
=>baseapp
$this->_init_session ();//$GLOBALS [' ec_env ']
=>ecmall.php (object Class)


ecapp.base.php (line 146)
Env (' Session ', $this->_session);//Implement $globals[' ec_env ' [' Session ']= $this->_session;


App.base.php ()
->display
->_init_view ();
->_config_view ();//ecapp.base.php



Template Folder Themes/mall/default
Controller Storage Folder/app
Template Compilation Folder temp/compiled



default.app.php (display ())
=>template.php ()
->display ();
->fetch ();
->make_compiled ();
->fetch_str ();
->smarty_prefilter_precompile (); Remove <!----, extract the contents of {} and send it to select ();
->select (); Parse {} contents



Login.html
One of the form action Properties has a value of NULL the current action's value is the URL of the current window




Login Verification Code
settings.arrayfile.php
Requires ' Captcha_status ' =>array (' login ' =>1), default is an empty array
Frontendapp::login ();
if (Conf::get (' Captcha_status.login ')) {$this->assign (' Captcha ', 1);}
Login.html
Contains the following code, that is, when the $captcha is true, the verification code code is displayed, the code is not executed when it is not true
<!--{if $captcha}-->
<tr><td>{$lang .captcha}:</td>
< td><input type= "text" name= "Captcha" class= "text" id= "Captcha1"/>
< Span><a href= "Javascript:change_captcha ($ (' #captcha '));" class= "renewedly" >
< img id= "CAPTCHA" src= "index.php?app=captcha&{$random _number}"/></a>
</span></td>
</tr>
<!--{/if}-->







Model
ecmall.php
& DB (); creating a MySQL Database object instance
Include_once (Root_path. ' /eccore/model/mysql.php ');
return new Cls_mysql ();
& M (); Get a model
Root_path. ' /includes/models/'. $model _name. Model.php ';
return new $model _name ($params, db ());

global.lib.php
& MS (); Member System connection interface
Include (Root_path. ') /includes/passport.base.php ')
Config.inc.php,member_type=> ' default ', default (using built-in user system)
Include (Root_path. ') /include/passports/'. Member_type. '. Passport.php ');
return new Ucfirst (member_type). ' Passport ';

Join
Custom model attribute $_relation=array ();

Query data in a module, such as $this->_user_mod->find (Array (..., ' join ' = ':,.. ',..));
Basemodel::find ();
$this->_joinmodel ($tables, $join);
$this->_getjoinstring ($_IM);

$_relation[' dependent ']= ' true '. If the member model is defined in relation to the store model. The store belongs to the (belong to) member.
The store model relies on the reference model and is deleted using the

Has_one,belongs_to The model relationship that is set in the custom model. The difference is in basemodel::_getjoinstring (); In the function, if it is Has_one,
The $refer_key= $this $prikey, if belongs_to, $refer_key= $model-a $prikey; $prikey is the variable set in the custom model, $this and $model are the two models respectively
References to instances of the model that are related to each other

Reverse, which is the relationship name for a custom model in the type for belongs_to relationship, is the value. If the member.model.php has $_relation (.., ' Manage_store ' =>array (' model ' = ' store ', ' reverse ' = ' be_manage ',..),..);
The $_relation attribute of M (' store ') has a be_manage relationship.

Has_one
This table reference key = Exterior foreign key
Belongs_to
Foreign key of this watch = exterior reference key
Has_and_belongs_to_many
This table primary key = Intermediate table foreign key

The middle table means that this table is a relational table between two tables, such as a table of relationships between a member table and a role table, which must contain the primary key for both tables if the membership table
The middle table is user_role named user and the role table is named roles













Landing page in the background,/ecmall/admin/index.php
=>ecmall::startup ();
=>ecmall.php
=>startup ();
=>require (DirName (__file__). ' /app '. " /{$app}.app.php ");(load Controller, default is default.app.php)
=>do_action ();(d o_action in the parent class Frontendapp of the parent class Ecbaseapp, Defaultapp parent Mallbaseapp,
Where class Mallbaseapp and class Frontendapp are in the frontend.base.php file, the Ecbaseapp class is in the ecapp.base.php file)
=>app.base.php
=>do_action (); Method of Ecbaseapp Class parent class Baseapp)
=>backend.base.php
=>_run_action ();
= = $this->login (), or parent::_run_action ();(ecapp.base.php)

*************************************************************************************************************** ********

Template
Show Pendant
Template::d isplay_widgets ();
Frontendapp::d isplay_widgets ();
Include_once '/includes/widget.base.php ';
& Widgets (); widget.base.php
Include_once (' external/widgets/'. $name. ' /main.widget.php '); $name values such as, notice
return new $name. ' Widget ' ();
Basewidget::basewidget ();
$this =id,widget_path,widget_root,_view,_view->lib_base,options;
Assign=options,widget_root,id,name
$widget->display (); Frontendapp::d isplay_widgets (); $widget =new $name. ' Widget ' ();
Basewidget::d isplay ();
Echo basewidget::get_contents ();
Basewidget::get_contents ();
Noticewidget::_get_data ();
Assgin=widget_data,options,widget_root
Basewidget::_wrap_contents ();


*************************************************************************************************************** ********
eccore/ecmall.php
Class Object function _error ($msg, $obj = "); There are instances in eccore/model/model.base.php

Research Ecmall Some process, structure notes (RPM)

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.