PhpCmsV9 two methods to call the subtopic of a specified topic

Source: Internet
Author: User
PhpCmsV9 two ways to call a specified topic sub-topic article PhpCmsV9 two ways to call a specified topic sub-topic article first, write the sub-topic id directly, use catin {pc: get? SqlSELECT * fromv9_newswherestatus99? Andcatidin (, 24, 25 )? OrderbyidDESCnum PhpCms V9 two methods to call the sub-topic articles of a specified topic

PhpCms V9 two methods to call the sub-topic articles of a specified topic

First, write the subtopic id directly, using cat in

{Pc: get? SQL = "SELECT * from v9_news where status = 99? And catid in (, 24, 25 )? Order by id DESC "num =" 7 "return =" data "}
{Loop $ data $ r}
? ?? ?

  • Url]} "title =" {$ r [title]} "target =" _ blank "> {str_cut ($ r ['title'], 40 )} ({date ('M-D', $ r [inputtime])})

  • {/Loop}
    {/Pc}

    Advantages of this method: the topic can be customized.
    Disadvantage: you need to write multiple ids. if you have added a topic in the background, you have to write the id again.

    Second, according to the parent topic idAs shown in the preceding sections, and 25 are subtopics under 15, which can be written as follows:

    {Loop subcat (15 )?? $ K $ v}
    {Php $ subcatid [] = $ k ;}
    {/Loop}
    {Php $ subcatid ?? = Implode (',', $ subcatid );}
    {Pc: get SQL = "SELECT * from v9_news where status = 99 and? Catid in ($ subcatid )? Order by id DESC "num =" 7 "return =" data "}
    {Loop $ data $ r}
    ? ?? ???
  • [{$ CATEGORYS [$ r [catid] [catname]}] {str_cut ($ r ['title'], 40 )}[{Date ('Y-m-D', $ r [inputtime])}]

  • {/Loop}
    {/Pc}

    Benefit: you only need to write a parent topic id, and the subtopic id is automatically obtained.
    Disadvantage: loop all subtopic IDs under the parent topic. if the content of a subtopic does not want to be displayed, it is difficult to implement

    The two methods have their own advantages and disadvantages, depending on the situation.

    ?

    Http://www.veryhuo.com/a/view/30459.html

    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.