Phpcms learning summary_php tutorial

Source: Internet
Author: User
Tags pconnect
Phpcms learning summary. | Caches _ * | admin. | index. | crossdomain. | robots. | favicon. PHPCMS is developed in MVC design mode. the module name is phpcmsmodules module extend.
|-Caches _ * |-admin. |-index. |-crossdomain. |-robots. |-favicon. PHPCMSIt is developed in MVC design mode. The/module name is phpcms // modules/module. if the controller class you added inherits other classes, be careful not to use the same method name as the method name in the class. Otherwise, your method will overwrite the original one. The naming rules of PHPCMS. The following naming rules should be followed when PHPCMS is used for secondary development: class files need to use. class. php is a suffix (this refers to the phpcms system class library file and the class library file in the module, which is not required by a third party), such as http. class. php. Function files must be suffixed with. func. php (not required by a third party), such as mail. func. php. The class name and file name are consistent. for example, the file name of the phpcmsapp class is phpcmsapp. class. php. The data model must be in the form of "data table name _ model. class. php". the class name and file name must be the same. The configuration file is configured in the caches/configs/directory. Configuration file call: Use the load_config method $ upload_url = pc_base: load_config ('configuration file', 'configuration key to be obtained ', 'default configuration. This value works when the configuration item fails to be retrieved. ',' force reload? '); example: Call the attachment path in system configuration $ upload_url = pc_base: load_config ('system ', 'upload _ url'); secondary development skills 1. if you want to perform secondary development on an existing controller, we do not recommend that you directly modify the kernel file to facilitate the upgrade. you can use "MY _*. php "form for secondary development. For example, you need to perform secondary development on phpcms/mood/index. php. You can create "MY_index.php" MY_index.php "in the same directory as index. php. the code is as follows:
 In this way, when you access the index controller through url, the system will point to MY_index.php by default and the method of the original file will be inherited and can be directly used. Database configuration file location: caches/configs/database. php we open this configuration file and add our database configuration information. The database configuration information is a two-dimensional array structure. the default value is default. you can configure multiple database links (for example, extended_1) based on the default structure)
 Array ('hostname' => 'localhost', 'database' => 'phpcms', 'username' => 'admin', 'password' => 'admin ', 'tablepre' => 'v9 _ ', 'charset' => 'gbk', 'type' => 'mysql', 'debug' => true, 'pconnect '=> 0, 'autoconnect' => 0),/* Add 'extended _ 1' => 'hostname' => '10. 10.125.2 ', 'database' => 'phpcms', 'username' => 'admin', 'password' => 'admin', 'tablepre' => 'v9 _', 'charset' => 'gbk', 'type' => 'mys Ql ', 'debug' =>, 'pconnect' => 0, 'autoconnect '=> 0,?> /Configs/route.
 ('M' => 'admin', 'C' => 'index', 'a' => 'init '), 'test .youname.com '=> ('M' => 'test', 'C' => 'index', 'a' => 'init'),?> ['Catid'
 'M' => 'phpcms', 'C' => 'index', 'a' => 'init ', 'data' => 'post' => 'catid' => 1, 'Get' => 'tentid' => 1?> = 2 then you use/configs/in the program /. 1.2.3.4.5.6. ///: "default"/modules/module/+. php. for example, if a controller named mytest is named mytest.1.mytest.
 : Http: 2. mytest_admin.
 1. \ Module Name Directory, this example is also in phpcms \ templates \: template ('test', 'mytest', 'default',. = 'Hello world! 'Template ('test', 'mytest', 'default' 2. -> admin_tpl ('mytest _ admin_list '. tpl. php. note: The background template must use. tpl .. = 'Oh, I am phpcmser '-> admin_tpl ('mytest _ admin_list'/model/+ '_ model. class. for php '"test", you must first create a database model file named 'test _ model. class. php'
 Db_config = pc_base: load_config ('database'-> db_setting = 'default'-> table_name = 'test':?> 1. 2.-> db_setting = 'default' 3.-> table_name = 'test'-> db = pc_base: load_model ('test _ model'
 Db-> select (); var_dump ($ result) ;}}?> -> For the methods supported in db, see methods in phpcms/libs/classes/model .. php.

Http://www.bkjia.com/PHPjc/750101.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/750101.htmlTechArticle | caches _ * | admin. | index. | crossdomain. | robots. | favicon. PHPCMS is developed in MVC design mode./module name: phpcms // modules/module 'extend...

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.