How does phpcms_v9 display or exclude certain topics subcat (0, 0, 0, $ siteid) and phpcms_v9subcat 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 ++}
<Div class = "box cat-area" {if $ num % 2! = 0} style = "margin-right: 10px" {/if}>
<H5 class = "title-1" >{$ r} <a href = "{$ r}" class = "more"> more >></a> </ h5>
<Div class = "content">
{Pc: content Action = "lists" catid = "$ r" order = "updatetime DESC" thumb = "1" num = "1" return = "info "}
{Loop $ info $ v}
<P>
<Strong> <Target = "_ blank" title = "{$ v ['title']}" {title_style ($ v) }>{ str_cut ($ v ['title'], 28) }</a> </strong> <br/> {str_cut ($ v ['description'], 100 )}
</P>
{/Loop}
{/Pc}
<Div class = "bk15 hr"> </div>
{Pc: content action = "lists" catid = "$ r" num = "5" order = "id DESC" return = "info "}
<Ul class = "list lh24 f14">
{Loop $ info $ v}
<Li> · <a href = "{$ v ['url']}" target = "_ blank" title = "{$ v ['title']}" {title_style ($ v)}> {str_cut ($ v ['title'], 40) }</a> </li>
{/Loop}
</Ul>
{/Pc}
</Div>
</Div>
{If $ num % 2 = 0} <div class = "bk10"> </div> {/if}
{/If}
{/Loop}
V9 how to exclude a topic
{Loop subcat (0, 0, 0, $ siteid) $ r}
{If $ r ['catid'] = 3} <? Php continue;?> {/If} // exclude a topic
{Php $ num ++}
<Div class = "box cat-area" {if $ num % 2! = 0} style = "margin-right: 10px" {/if}>
<H5 class = "title-1" >{$ r} <a href = "{$ r}" class = "more"> more >></a> </ h5>
<Div class = "content">
{Pc: content Action = "lists" catid = "$ r" order = "updatetime DESC" thumb = "1" num = "1" return = "info "}
{Loop $ info $ v}
<P>
<Strong> <Target = "_ blank" title = "{$ v ['title']}" {title_style ($ v) }>{ str_cut ($ v ['title'], 28) }</a> </strong> <br/> {str_cut ($ v ['description'], 100 )}
</P>
{/Loop}
{/Pc}
<Div class = "bk15 hr"> </div>
{Pc: content action = "lists" catid = "$ r" num = "5" order = "id DESC" return = "info "}
<Ul class = "list lh24 f14">
{Loop $ info $ v}
<Li> · <a href = "{$ v ['url']}" target = "_ blank" title = "{$ v ['title']}" {title_style ($ v)}> {str_cut ($ v ['title'], 40) }</a> </li>
{/Loop}
</Ul>
{/Pc}
</Div>
</Div>
{If $ num % 2 = 0} <div class = "bk10"> </div> {/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;
}
Call topic of phpcms v9, with each 4 topics changed once
<? Php $ I = 1;?> {Loop subcat (0, 0, $ siteid) $ r }{$ r [catname]} <? Php if ($ I % 4 = 0) {echo "<br>" ;}?> {$ I ++} {/loop} gives a sample
In PHPCMS, what is {php $ data = subcat ($ module, $ catid?
Check this URL.
Reference: bbs.phpcms.cn/...subcat