Two methods for Phpcms V9 to call the column sub-column
Two methods for Phpcms V9 to call the column sub-column
The first, directly write the sub-column ID, with Cat in
{pc:get? sql= "SELECT * from V9_news where status=99? and catid in (21,22,23,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}
The benefits of this approach: You can take that column to definition
Cons: To write multiple IDs, BackstageIf you add a column, you have to write the ID again.
the second type, according to the parent column ID, such as the above 21,22,23,24,25 are 15 below the sub-column, you can write:
{Loop subcat ( the)?? $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}
Benefits: Just write a parent column ID, automaticallyTake the subordinate sub-column ID
Disadvantage: The circular parent column under all the sub-column ID, if the content of a sub-column does not want to display, not good implementation
Both methods have pros and cons, depending on the circumstances of the election.
?
Http://www.veryhuo.com/a/view/30459.html