Phpcms V9 Easy Two-time development

Source: Internet
Author: User
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"}

  • Related Article

    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.