Find the code to modify

2016-08-29 10:12:30    tengfei    9976

You have to know how to find the code corresponding to certain content you want to change before you can modify it. After learning the directory of Zsite, let's see how to find those codes to modify.


1. Locate the code via Control

Let's see an example first. Example :

article-browse-1.html or /?m=article&f=browse&category=1&t=html


article-browse-1.html means the method to browse the modules of article; the first parameter is 1; the page type to access is h tml.
/?m= article&f=browse&productID=1&t=html

m is the name of a module; f is the name of a method; what is behind that is parameter list.

Now let's take a look at Zsite source code, the method to browse in system/module/ article/control.php


The URL at the frontend of Zsite has been SEOed, so the alias of a category might show here. You can change "Request Type" to "Get", and then check URL address again.


2. Calling in Control

$this->bug is to call model in bug, so the file is at module/bug/model.php.

$this->loadmoel('tree')->xxx is to load modlel in tree and its file is at module/tree/model.php.
$this->app->loadClass('pager') is to load a lib, and its file is at lib/pager/pager.class.php.
$this->lang->bug->xxx is defined in module/bug/lang/zh-cn.php. zh-cn can be changed to language your need.

Following $this->display() is the call of templates with the same method in the directory of view. For example, the method to browse a bug and its file in module/bug/view/browse.html.php.


3. Template files

Zsite templates include templates at the frontend and the ones at the backend. index.php will call the frontend template, and admin.php will call backend template.

For example, the method of Product List page is to browse and its frontend template is at www/template/default/product/browse.html.php, while its backend template is at system/module/product/view/browse.html.php.

The method of lists and pages is to browse and detailed content is to view.

Block templates are in the directory of www/template/default/block/

Zsite 5.2+ version support editing template at backend by going to "Design"->"Template editing" , and the storage can be found at system/tmp/template).


4. Language files

Language displayed on the interface is included in language file of each module. For example, in the directory of Product module, system/module/product/lang, zh-cn is the simplified Chinese file, zh-tw is the traditional Chinese files, and en is the English file.


Backend language can be set in the language file of the common module.


ZSite8.0