{str_cut($v['description' ],100)}
- ·{str_cut($v['title'] ,40)}
Use the column id in the red part below to control which columns are displayed. The id is queried in the background according to the actual situation. For the subcat function, see the explanation in the last attachment. Modify the code as follows:
{loop subcat(0,0,0,$siteid) $r}
http://blog.csdn.net/a1079540945/article/details/{$r}More>>
{str_cut($v['description' ],100)}
{loop subcat(0,0,0,$siteid) $r}
{if $r['catid']==3 }{/if} //Exclude a certain column
http://blog.csdn.net/a1079540945/article/details/{$r}More>>
{str_cut($v['description' ],100)}
=====================================================
{loop subcat(0,0,0,$siteid) $r}{/loop}函数解释:
{loop subcat(0,0,0,$siteid) $r}{/loop}
/**
* Get sub-column
* @param $parentid parent id
* @param $type column type 1 is a single web page type, 0 is a column type; (you can see it by looking at the mysql database of phpcms)
* @param $self Whether it contains itself 0 means it does not contain
* @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;
}