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