Phpcms V9 Simple two-time development
more than two development tips to view PHPCMS system help , the cache caches\caches_template\default after the foreground template parsing
Front control class index.php, front Label class *_tag.class.php, foreground variables can be in the foreground control class, the foreground label class combined with the return
?
Add a new function module, his information storage with the article model field some can not be satisfied , generally take what methods to solve?
1. You can add fields directly to the database (background Model Management--Article Model---field management, or directly add in the database)
2. Customizing the new field model (background Model Management-adding models)
3. Create a new table directly
?
Two times development Add a database table with a different token, which is distinguished by the following:
Database configuration file Location: caches/configs/database.php
?
Array (' hostname ' = ' localhost ', ' database ' = ' phpcms ', ' username ' = ' admin ', ' password ' => ; ' admin ', ' tablepre ' = ' v9_ ', ' charset ' = ' gbk ', ' type ' = ' mysql ', ' debug ' = ' = ', ' PCO Nnect ' = 0, ' AutoConnect ' + 0), /* The following default does not exist */' extended ' = = Array (' hostname ' = ' localhos ') T ', ' database ' = ' phpcms ', ' username ' = ' admin ', ' password ' = ' admin ', ' tablepre ' and ' Ext_ ' , ' charset ' = ' gbk ', ' type ' = ' mysql ', ' debug ' = ' = ', ' pconnect ' + 0, ' autoconnect ' = > 0);?>
?
URL Access
http : //yourdomain.com/index.php?m=content&c=index&a=show&id=1
m = content for model/module name in Phpcms/modules/content
c = index? is the controller name? Located in phpcms/modules/content/index.php
a = Show is the time name? The show () method in phpcms/modules/content/index.php
id = 1 is the same as the normal get pass parameter for other parameters
The PHPCMS default route is fixed to the init operation in the Content module's index controller , because the system executes the default modules and operations when no modules and controllers are specified.
?
1. Modify the default home page
Modify the/caches/configs/route.php file
?
2. Create model
Create a new Model phpcms/model/format: my_model.class.php my refers to the table name, the basic format is as follows:
Db_config = pc_base::load_config (' database '); $this->db_setting = ' default '; $this->table_name = ' my '; Parent::__construct (); }}? >
3. Create modules
Create a new my directory under its directory has classes functions templates-------Here is the background modules, creating a foreground PHP file mytest.php its basic content is as follows:
db = Pc_base::load_model (' My_model '); } Public Function init () { $result = $this->db->select (); Var_dump ($result); Include template (' My ', ' my ', $result); My is the Templates directory, the second my is the file name, $result is the style name, the default is not filled with defalut } public function MyList () { $var = ' Hello ' World!this is a example! '; echo $var; $siteid = Get_siteid (), $SEO = SEO ($siteid, ', $var); include $this->admin_tpl ("Mytest_admin_list");} }? >
? 4. Create templates
Backstage templates in Phpcms\modules\mytest\templates
Front desk in Phpcms\templates
Create a new My directory my is the Include template (' My ', ' my ', $style);
{Template "content", "header"} {Loop $result $value} User id:{$value [' ID ']} Password: {$value [' username ']}
{/loop} {Template "Content", "Footer"}