当前位置: 首页>>代码示例>>PHP>>正文


PHP category_get_num函数代码示例

本文整理汇总了PHP中category_get_num函数的典型用法代码示例。如果您正苦于以下问题:PHP category_get_num函数的具体用法?PHP category_get_num怎么用?PHP category_get_num使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了category_get_num函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showcategoryrow

function showcategoryrow($key, $level = 0, $last = '')
{
    global $category, $permissioncategory, $permission;
    $value = $category[$key];
    $return = '';
    $op = $addarticle = $artilcemanage = '';
    $value['articles'] = category_get_num('portal', $key);
    if (checkperm('allowmanagearticle') || checkperm('allowmanage') || $permission[$key]['allowmanage']) {
        $addarticle .= '<a href="portal.php?mod=portalcp&ac=category&catid=' . $key . '" class="y">' . lang('portalcp', 'article_manage') . '</a>';
    }
    if ((checkperm('allowmanagearticle') || checkperm('allowpostarticle') || $permission[$key]['allowmanage'] || $permission[$key]['allowpublish']) && empty($value['disallowpublish'])) {
        $artilcemanage .= '<a href="portal.php?mod=portalcp&ac=article&catid=' . $value['catid'] . '" target="_blank" class="y">' . lang('portalcp', 'article_publish') . '</a>';
    }
    if ($addarticle && $artilcemanage) {
        $op = $addarticle . '<span class="pipe y">|</span>' . $artilcemanage;
    } else {
        $op = $addarticle ? $addarticle : $artilcemanage;
    }
    if ($level == 2) {
        $class = $last ? 'lastchildcat' : 'childcat';
        $return = '<tr class="hover"><td><div class="' . $class . '"><a href="portal.php?mod=portalcp&ac=category&catid=' . $key . '">' . $value['catname'] . '</a>' . '</div></td><td>' . $value['articles'] . '</td><td>' . $op . '</td></tr>';
    } elseif ($level == 1) {
        $return = '<tr class="hover"><td><div class="cat"><a href="portal.php?mod=portalcp&ac=category&catid=' . $key . '">' . $value['catname'] . '</a>' . '</td><td>' . $value['articles'] . '</td><td>' . $op . '</td></tr>';
        $children = checkperm('allowmanagearticle') ? $category[$key]['children'] : $permissioncategory[$key]['permissionchildren'];
        $i = 1;
        $l = count($children);
        foreach ($children as $v) {
            $return .= showcategoryrow($v, 2, $i++ == $l);
        }
    } else {
        $return = '<tr class="hover"><td><div class="parentcat"><a href="portal.php?mod=portalcp&ac=category&catid=' . $key . '">' . $value['catname'] . '</a>' . '</div></td><td>' . $value['articles'] . '</td><td>' . $op . '</td></tr>';
        $children = checkperm('allowmanagearticle') ? $category[$key]['children'] : $permissioncategory[$key]['permissionchildren'];
        foreach ($children as $v) {
            $return .= showcategoryrow($v, 1);
        }
    }
    return $return;
}
开发者ID:dalinhuang,项目名称:hlwbbsvincent,代码行数:38,代码来源:portalcp_index.php

示例2: showcategoryrow

function showcategoryrow($key, $level = 0, $last = '')
{
    global $_G;
    loadcache('yuexiamen');
    $value = $_G['cache']['yuexiamen'][$key];
    $return = '';
    // 	include_once libfile('function/portalcp');
    $value['articles'] = category_get_num('portal', $key);
    $publish = '';
    if (empty($_G['cache']['portalcategory'][$key]['disallowpublish'])) {
        $publish = '&nbsp;<a href="portal.php?mod=portalcp&ac=article&catid=' . $key . '" target="_blank">' . cplang('portalcategory_publish') . '</a>';
    }
    if ($level == 2) {
        $class = $last ? 'lastchildboard' : 'childboard';
        $return = '<tr class="hover" id="cat' . $value['catid'] . '"><td>&nbsp;</td><td class="td25"><input type="text" class="txt" name="neworder[' . $value['catid'] . ']" value="' . $value['displayorder'] . '" /></td><td><div class="' . $class . '">' . '<input type="text" class="txt" name="name[' . $value['catid'] . ']" value="' . $value['catname'] . '" />' . '</div>' . '</td><td>' . $value['articles'] . '</td>' . '<td>' . (empty($value['disallowpublish']) ? cplang('yes') : cplang('no')) . '</td>' . '<td>' . (!empty($value['allowcomment']) ? cplang('yes') : cplang('no')) . '</td>' . '<td>' . (empty($value['closed']) ? cplang('yes') : cplang('no')) . '</td>' . '<td><input class="radio" type="radio" name="newsetindex" value="' . $value['catid'] . '" ' . ($value['caturl'] == $_G['setting']['defaultindex'] ? 'checked="checked"' : '') . ' /></td>' . '<td><a href="' . $value['caturl'] . '" target="_blank">' . cplang('view') . '</a>&nbsp;
		<a href="' . ADMINSCRIPT . '?action=portalcategory&operation=edit&catid=' . $value['catid'] . '">' . cplang('edit') . '</a>&nbsp;
		<a href="' . ADMINSCRIPT . '?action=portalcategory&operation=move&catid=' . $value['catid'] . '">' . cplang('portalcategory_move') . '</a>&nbsp;
		<a href="' . ADMINSCRIPT . '?action=portalcategory&operation=delete&catid=' . $value['catid'] . '">' . cplang('delete') . '</a>&nbsp;
		<a href="' . ADMINSCRIPT . '?action=diytemplate&operation=perm&targettplname=portal/list_' . $value['catid'] . '&tpldirectory=' . getdiydirectory($value['primaltplname']) . '">' . cplang('portalcategory_blockperm') . '</a></td>
		<td><a href="' . ADMINSCRIPT . '?action=article&operation=list&&catid=' . $value['catid'] . '">' . cplang('portalcategory_articlemanagement') . '</a>&nbsp;
		<a href="' . ADMINSCRIPT . '?action=portalcategory&operation=perm&catid=' . $value['catid'] . '">' . cplang('portalcategory_articleperm') . '</a>' . $publish . '</td></tr>';
    } elseif ($level == 1) {
        $return = '<tr class="hover" id="cat' . $value['catid'] . '"><td>&nbsp;</td><td class="td25"><input type="text" class="txt" name="neworder[' . $value['catid'] . ']" value="' . $value['displayorder'] . '" /></td><td><div class="board">' . '<input type="text" class="txt" name="name[' . $value['catid'] . ']" value="' . $value['catname'] . '" />' . '<a class="addchildboard" href="' . ADMINSCRIPT . '?action=portalcategory&operation=add&upid=' . $value['catid'] . '">' . cplang('portalcategory_addthirdcategory') . '</a></div>' . '</td><td>' . $value['articles'] . '</td>' . '<td>' . (empty($value['disallowpublish']) ? cplang('yes') : cplang('no')) . '</td>' . '<td>' . (!empty($value['allowcomment']) ? cplang('yes') : cplang('no')) . '</td>' . '<td>' . (empty($value['closed']) ? cplang('yes') : cplang('no')) . '</td>' . '<td><input class="radio" type="radio" name="newsetindex" value="' . $value['catid'] . '" ' . ($value['caturl'] == $_G['setting']['defaultindex'] ? 'checked="checked"' : '') . ' /></td>' . '<td><a href="' . $value['caturl'] . '" target="_blank">' . cplang('view') . '</a>&nbsp;
		<a href="' . ADMINSCRIPT . '?action=portalcategory&operation=edit&catid=' . $value['catid'] . '">' . cplang('edit') . '</a>&nbsp;
		<a href="' . ADMINSCRIPT . '?action=portalcategory&operation=move&catid=' . $value['catid'] . '">' . cplang('portalcategory_move') . '</a>&nbsp;
		<a href="' . ADMINSCRIPT . '?action=portalcategory&operation=delete&catid=' . $value['catid'] . '">' . cplang('delete') . '</a>&nbsp;
		<a href="' . ADMINSCRIPT . '?action=diytemplate&operation=perm&targettplname=portal/list_' . $value['catid'] . '&tpldirectory=' . getdiydirectory($value['primaltplname']) . '">' . cplang('portalcategory_blockperm') . '</a></td>
		<td><a href="' . ADMINSCRIPT . '?action=article&operation=list&&catid=' . $value['catid'] . '">' . cplang('portalcategory_articlemanagement') . '</a>&nbsp;
		<a href="' . ADMINSCRIPT . '?action=portalcategory&operation=perm&catid=' . $value['catid'] . '">' . cplang('portalcategory_articleperm') . '</a>' . $publish . '</td></tr>';
        for ($i = 0, $L = count($value['children']); $i < $L; $i++) {
            $return .= showcategoryrow($value['children'][$i], 2, $i == $L - 1);
        }
    } else {
        $childrennum = count($_G['cache']['portalcategory'][$key]['children']);
        $toggle = $childrennum > 25 ? ' style="display:none"' : '';
        $return = '<tbody><tr class="hover" id="cat' . $value['catid'] . '"><td onclick="toggle_group(\'group_' . $value['catid'] . '\')"><a id="a_group_' . $value['catid'] . '" href="javascript:;">' . ($toggle ? '[+]' : '[-]') . '</a></td>' . '<td class="td25"><input type="text" class="txt" name="neworder[' . $value['catid'] . ']" value="' . $value['displayorder'] . '" /></td><td><div class="parentboard">' . '<input type="text" class="txt" name="name[' . $value['catid'] . ']" value="' . $value['catname'] . '" />' . '</div>' . '</td><td>' . $value['articles'] . '</td>' . '<td>' . (empty($value['disallowpublish']) ? cplang('yes') : cplang('no')) . '</td>' . '<td>' . (!empty($value['allowcomment']) ? cplang('yes') : cplang('no')) . '</td>' . '<td>' . (empty($value['closed']) ? cplang('yes') : cplang('no')) . '</td>' . '<td><input class="radio" type="radio" name="newsetindex" value="' . $value['catid'] . '" ' . ($value['caturl'] == $_G['setting']['defaultindex'] ? 'checked="checked"' : '') . ' /></td>' . '<td><a href="' . $value['caturl'] . '" target="_blank">' . cplang('view') . '</a>&nbsp;
		<a href="' . ADMINSCRIPT . '?action=portalcategory&operation=edit&catid=' . $value['catid'] . '">' . cplang('edit') . '</a>&nbsp;
		<a href="' . ADMINSCRIPT . '?action=portalcategory&operation=move&catid=' . $value['catid'] . '">' . cplang('portalcategory_move') . '</a>&nbsp;
		<a href="' . ADMINSCRIPT . '?action=portalcategory&operation=delete&catid=' . $value['catid'] . '">' . cplang('delete') . '</a>&nbsp;
		<a href="' . ADMINSCRIPT . '?action=diytemplate&operation=perm&targettplname=portal/list_' . $value['catid'] . '&tpldirectory=' . getdiydirectory($value['primaltplname']) . '">' . cplang('portalcategory_blockperm') . '</a></td>
		<td><a href="' . ADMINSCRIPT . '?action=article&operation=list&&catid=' . $value['catid'] . '">' . cplang('portalcategory_articlemanagement') . '</a>&nbsp;
		<a href="' . ADMINSCRIPT . '?action=portalcategory&operation=perm&catid=' . $value['catid'] . '">' . cplang('portalcategory_articleperm') . '</a>' . $publish . '</td></tr></tbody>
		<tbody id="group_' . $value['catid'] . '"' . $toggle . '>';
        for ($i = 0, $L = count($value['children']); $i < $L; $i++) {
            $return .= showcategoryrow($value['children'][$i], 1, '');
        }
        $return .= '</tdoby><tr><td>&nbsp;</td><td colspan="9"><div class="lastboard"><a class="addtr" href="' . ADMINSCRIPT . '?action=portalcategory&operation=add&upid=' . $value['catid'] . '">' . cplang('portalcategory_addsubcategory') . '</a></td></div>';
    }
    return $return;
}
开发者ID:renning,项目名称:html,代码行数:50,代码来源:admincp_yuexiamen.php

示例3: category_get_num

function category_get_num($type, $catid)
{
    global $_G;
    if (!in_array($type, array('portal', 'blog', 'album'))) {
        return array();
    }
    loadcache($type . 'category');
    $category = $_G['cache'][$type . 'category'];
    $numkey = $type == 'portal' ? 'articles' : 'num';
    if (!isset($_G[$type . 'category_nums'])) {
        $_G[$type . 'category_nums'] = array();
        $tables = array('portal' => 'portal_category', 'blog' => 'home_blog_category', 'album' => 'home_album_category');
        $query = C::t($tables[$type])->fetch_all_numkey($numkey);
        foreach ($query as $value) {
            $_G[$type . 'category_nums'][$value['catid']] = intval($value[$numkey]);
        }
    }
    $nums = $_G[$type . 'category_nums'];
    $num = intval($nums[$catid]);
    if ($category[$catid]['children']) {
        foreach ($category[$catid]['children'] as $id) {
            $num += category_get_num($type, $id);
        }
    }
    return $num;
}
开发者ID:softhui,项目名称:discuz,代码行数:26,代码来源:function_portalcp.php

示例4: showcategoryrow

function showcategoryrow($key, $level = 0, $last = '')
{
    global $_G;
    loadcache('blogcategory');
    $value = $_G['cache']['blogcategory'][$key];
    $return = '';
    include_once libfile('function/portalcp');
    $value['num'] = category_get_num('blog', $key);
    if ($level == 2) {
        $class = $last ? 'lastchildboard' : 'childboard';
        $return = '<tr class="hover"><td class="td25"><input type="text" class="txt" name="order[' . $value['catid'] . ']" value="' . $value['displayorder'] . '" /></td><td><div class="' . $class . '">' . '<input type="text" name="name[' . $value['catid'] . ']" value="' . $value['catname'] . '" class="txt" />' . '</div>' . '</td><td>' . $value[num] . '</td><td><a href="' . ADMINSCRIPT . '?action=blogcategory&operation=delete&catid=' . $value['catid'] . '">' . cplang('delete') . '</a></td></tr>';
    } elseif ($level == 1) {
        $return = '<tr class="hover"><td class="td25"><input type="text" class="txt" name="order[' . $value['catid'] . ']" value="' . $value['displayorder'] . '" /></td><td><div class="board">' . '<input type="text" name="name[' . $value['catid'] . ']" value="' . $value['catname'] . '" class="txt" />' . '<a class="addchildboard" onclick="addrowdirect = 1;addrow(this, 2, ' . $value['catid'] . ')" href="###">' . cplang('blogcategory_addthirdcategory') . '</a></div>' . '</td><td>' . $value[num] . '</td><td><a href="' . ADMINSCRIPT . '?action=blogcategory&operation=delete&catid=' . $value['catid'] . '">' . cplang('delete') . '</a></td></tr>';
        for ($i = 0, $L = count($value['children']); $i < $L; $i++) {
            $return .= showcategoryrow($value['children'][$i], 2, $i == $L - 1);
        }
    } else {
        $return = '<tr class="hover"><td class="td25"><input type="text" class="txt" name="order[' . $value['catid'] . ']" value="' . $value['displayorder'] . '" /></td><td><div class="parentboard">' . '<input type="text" name="name[' . $value['catid'] . ']" value="' . $value['catname'] . '" class="txt" />' . '</div>' . '</td><td>' . $value[num] . '</td><td><a href="' . ADMINSCRIPT . '?action=blogcategory&operation=delete&catid=' . $value['catid'] . '">' . cplang('delete') . '</a></td></tr>';
        for ($i = 0, $L = count($value['children']); $i < $L; $i++) {
            $return .= showcategoryrow($value['children'][$i], 1, '');
        }
        $return .= '<tr><td class="td25"></td><td colspan="3"><div class="lastboard"><a class="addtr" onclick="addrow(this, 1, ' . $value['catid'] . ')" href="###">' . cplang('blogcategory_addsubcategory') . '</a></div>';
    }
    return $return;
}
开发者ID:pan289091315,项目名称:Discuz,代码行数:25,代码来源:admincp_blogcategory.php

示例5: category_get_num

function category_get_num($type, $catid)
{
    global $_G;
    if (!in_array($type, array("pdnovel"))) {
        return array();
    }
    loadcache($type . "category");
    $category = $_G['cache'][$type . "category"];
    $numkey = $type == "pdnovel" ? "articles" : "num";
    if (!isset($_G[$type . "category_nums"])) {
        $_G[$type . "category_nums"] = array();
        $tables = array("pdnovel" => "pdnovel_category");
        $query = DB::query("SELECT catid, " . $numkey . " FROM " . DB::table($tables[$type]));
        while ($value = DB::fetch($query)) {
            $_G[$type . "category_nums"][$value['catid']] = intval($value[$numkey]);
        }
    }
    $nums = $_G[$type . "category_nums"];
    $num = intval($nums[$catid]);
    if ($category[$catid]['children']) {
        foreach ($category[$catid]['children'] as $id) {
            $num += category_get_num($type, $id);
        }
    }
    return $num;
}
开发者ID:chibimiku,项目名称:pdnovel_for_discuz_x2,代码行数:26,代码来源:function_pdnovelcp.php


注:本文中的category_get_num函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。