Phpcms is difficult to write.

Source: Internet
Author: User
It is difficult to write phpcms. the following code is written in a static html file.
How can I modify it if I write it in the PHP file?
{pc:content action="lists" catid="6" order="id DESC" thumb="" moreinfo=""  return="data" }{loop $data $n $r}
  • {$r['title']}
  • {/loop}{/pc}


    I tried to copy the files in the cache directly into the php file, but it seems that the cache is a lot of messy, redundant code, whether it is written or not.
    What about the clean code?


    Reply to discussion (solution)

    {Pc: content action = "lists" catid = "6" order = "id DESC" thumb = "" moreinfo = "" return = "data "}
    The meaning is:
    Query the content data table (lists)
    The condition is classification 6.
    Sort by id in descending order
    Put the result in an array named data.

    select * from lists where catid=6 order by id desc

    {Loop $ data $ n $ r}
  • {$ R ['title']}

  • {/Loop}
    The meaning is: loop output to the queried array.
    foeeach($data as $n=>$r) {  echo "
  • {$r['title']}
  • ":}

    {Pc: content action = "lists" catid = "6" order = "id DESC" thumb = "" moreinfo = "" return = "data "}
    The meaning is:
    Query the content data table (lists)
    The condition is classification 6.
    Sort by id in descending order
    Put the result in an array named data.

    select * from lists where catid=6 order by id desc

    {Loop $ data $ n $ r}
  • {$ R ['title']}

  • {/Loop}
    The meaning is: loop output to the queried array.
    foeeach($data as $n=>$r) {  echo "
  • {$r['title']}
  • ":}


    Lists is not a table but a method. For more information, see the phpcms manual.

    Then you can find the answer in the manual.
    I don't need phpcms, so I am looking for answers online http://bbs.phpcms.cn/thread-287675-1-1.html

    Method 1: Find the phpcms template engine and parse the string separately.
    Method 2: manually rewrite the template tag to a php script

    For PC tag compilation, see the pc_tag () method in the template engine phpcms/libs/classes/template_cache.class.php in the system class library.
    {Pc: module name/operation method parameter = "parameter value"} {/pc}

    For example, {pc: content action = "lists" catid = "6" order = "id DESC" thumb = "" moreinfo = "" return = "data "}, actually, it is the list of content that calls the content module.
    The catid is used to determine the model and table name of the column, and return is the variable name of the returned query result.
    In this step, you can see phpcms/modules/classes/content_tag.class.php. This is the class used by the pc label to call the content module.

    Method 1: Find the phpcms template engine and parse the string separately.
    Method 2: manually rewrite the template tag to a php script


    Can you tell me how to resolve it separately? it's a bit dizzy.


    Method 1: Find the phpcms template engine and parse the string separately.
    Method 2: manually rewrite the template tag to a php script


    Can you tell me how to resolve it separately? it's a bit dizzy.



    So I wrote method 2...
    But I'm wondering why I want to transfer the template content to php.



    Method 1: Find the phpcms template engine and parse the string separately.
    Method 2: manually rewrite the template tag to a php script


    Can you tell me how to resolve it separately? it's a bit dizzy.



    So I wrote method 2...
    But I'm wondering why I want to transfer the template content to php.


    Where is Method 2? it is better not to be too general. Cainiao like ours need specific methods,

    Cainiao... are modest and polite.
    #1 have answered you

    Cainiao... are modest and polite.
    #1 have answered you



    Cainiao... are modest and polite.
    #1 have answered you


    Can you stop messing around? you won't die if you don't talk. believe me.

    #1. you have already answered the question. you can find the lists method and check which table is used. it will be better to replace the table name.

    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.