Introduction

2018-07-16 09:44:51
tengfei
9347
Last edited by tengfei on 2019-01-08 09:26:12

Our team has used PHP for more than ten years and has also tried many PHP open source software. A common problem of using all these PHP based tools is: 


There is no way to upgrade it to the latest version,  if the code has been modified for customization. 


Some use a hook to extend, such as WordPress, Drupal, Discuz, but this is based on action or event, which means that only a limited modification can be made to the original system. Therefore, it has a strong restriction on the original system, so there is no way to make a more thorough modification.


When we designed zentaoPHP, we have paid special attention to the extensibility. Thanks to the enhancement of OOP syntax in PHP5.2+, zentaoPHP implements a thorough extension mechanism.


Applications developed in zentaoPHP are made up of modules. Each module corresponds to a directory, such as a user module. Each module is divided according to MVC, with its own control (control layer), model (model level) and view (view layer). At the same time, several auxiliary concepts are provided: config (configuration), Lang (Language), CSS (style) and JS (JS script). Through the extension mechanism of zentaoPHP, any layer can be extended.


The followings are the directory structure of extended codes:


user/control.php
user/model.php
user/view/{metho1.html.php, method2.html.php, ...}
user/config/config.php
user/css/{method1.css, method2.css, common.css, ...}
user/js/{method1.js, method2.js, common.js, ...}
user/ext/control/{method1.php, method2.php, ...}
user/ext/model/{extend1.php, extend2.php, ...}
user/ext/view/{method1.html.php, method2.html.php, ...}
user/ext/config/{config1.php, config2.php, ...}
user/ext/lang/zh-cn/{lang1.php, lang2.php, ...}
user/ext/lang/en/{lang1.php, lang2.php, ...}
user/ext/css/method1/{1.css, 2.css, ...}
user/ext/js/method1/{1.js, 2.js, ...}


As long as you deploy the extension code to the corresponding directory according to our extension mechanism, you can redefine it or add features to the existing features. Because the extended code is separated from the trunk, you don't have to worry about that the extension will be overridden when the trunk is updated.


Write a Comment
Comment will be posted after it is reviewed.