How does phpcms_v9 display or exclude certain topics subcat (, 0, $ siteid) on the home page)
V9 how to display or exclude certain topics in the home page subcat (, 0, $ siteid)
You can use the column id in the red section below to control which columns are displayed. The id is queried in the background based on the actual situation. The subcat function is used to view the last appendix explanation. The following code is modified:
What columns are displayed in V9?
{Loop subcat (0, 0, 0, $ siteid) $ r}
{If $ r ['catid'] = 1 | $ r ['catid'] = 2} // which columns are displayed?
{Php $ num ++}
Http://blog.csdn.net/a1079540945/article/details/?#r=more>
{Pc: content Action = "lists" catid = "$ r" order = "updatetime DESC" thumb = "1" num = "1" return = "info "}
{Loop $ info $ v}
Target = "_ blank" title = "{$ v [" title']} "{title_style ($ v) }>{ str_cut ($ v ['title'], 28 )}
{Str_cut ($ v ['description'], 100 )}
{/Loop}
{/Pc}
{Pc: content action = "lists" catid = "$ r" num = "5" order = "id DESC" return = "info "}
{Loop $ info $ v}
- · {Str_cut ($ v ['title'], 40 )}
{/Loop}
{/Pc}
{If $ num % 2 = 0} {/if}
{/If}
{/Loop}
V9 how to exclude a topic
{Loop subcat (0, 0, 0, $ siteid) $ r}
{If $ r ['catid'] = 3} {/If} // exclude a topic
{Php $ num ++}
Http://blog.csdn.net/a1079540945/article/details/?#r=more>
{Pc: content Action = "lists" catid = "$ r" order = "updatetime DESC" thumb = "1" num = "1" return = "info "}
{Loop $ info $ v}
Target = "_ blank" title = "{$ v [" title']} "{title_style ($ v) }>{ str_cut ($ v ['title'], 28 )}
{Str_cut ($ v ['description'], 100 )}
{/Loop}
{/Pc}
{Pc: content action = "lists" catid = "$ r" num = "5" order = "id DESC" return = "info "}
{Loop $ info $ v}
- · {Str_cut ($ v ['title'], 40 )}
{/Loop}
{/Pc}
{If $ num % 2 = 0} {/if}
{/Loop}
========================================================== ==================
{Loop subcat (0, 0, 0, $ siteid) $ r} {/loop} function explanation:
{Loop subcat (0, 0, 0, $ siteid) $ r} {/loop}
/**
* Obtain subtopics
* @ Param $ parentid parent id
* @ Param $ type column type 1 is a single webpage type, and 0 is a topic type. (You can view the mysql database of phpcms)
* @ Param $ whether self contains itself 0 is not included
* @ Param $ siteid site id
*/
Function subcat ($ parentid = NULL, $ type = NULL, $ self = '0', $ siteid = ''){
If (empty ($ siteid) $ siteid = get_siteid ();
$ Category = getcache ('category _ content _ '. $ siteid, 'commons ');
Foreach ($ category as $ id => $ cat ){
If ($ cat ['siteid'] = $ siteid & ($ parentid = NULL | $ cat ['parentid'] = $ parentid) & ($ type = NULL | $ cat ['type'] = $ type) $ subcat [$ id] = $ cat;
If ($ self = 1 & $ cat ['catid'] = $ parentid &&! $ Cat ['child ']) $ subcat [$ id] = $ cat;
}
Return $ subcat;
}