zblog后台文章管理添加浏览数,实现方法如下,修改文件:
zb_system/function/c_system_admin.php 添加两行代码
/** * 后台文章管理. */ function Admin_ArticleMng() { global $zbp; echo '<div class="divHeader">' . $zbp->lang['msg']['article_manage'] . '</div>'; echo '<div class="SubMenu">'; foreach ($GLOBALS['hooks']['Filter_Plugin_Admin_ArticleMng_SubMenu'] as $fpname => &$fpsignal) { $fpname(); } echo '</div>'; echo '<div id="divMain2">'; echo '<form class="search" id="search" method="post" action="#">'; echo '<p>' . $zbp->lang['msg']['search'] . ': ' . $zbp->lang['msg']['category'] . ' <select class="edit" size="1" name="category" style="width:140px;" ><option value="">' . $zbp->lang['msg']['any'] . '</option>'; foreach ($zbp->categoriesbyorder as $id => $cate) { echo '<option value="' . $cate->ID . '">' . $cate->SymbolName . '</option>'; } echo '</select> ' . $zbp->lang['msg']['type'] . ' <select class="edit" size="1" name="status" style="width:100px;" ><option value="">' . $zbp->lang['msg']['any'] . '</option> <option value="0" >' . $zbp->lang['post_status_name']['0'] . '</option><option value="1" >' . $zbp->lang['post_status_name']['1'] . '</option><option value="2" >' . $zbp->lang['post_status_name']['2'] . '</option></select> <label><input type="checkbox" name="istop" value="True"/> ' . $zbp->lang['msg']['top'] . '</label> <input name="search" style="width:250px;" type="text" value="" /> <input type="submit" class="button" value="' . $zbp->lang['msg']['submit'] . '"/></p>'; echo '</form>'; $p = new Pagebar('{%host%}zb_system/cmd.php?act=ArticleMng{&page=%page%}{&status=%status%}{&istop=%istop%}{&category=%category%}{&search=%search%}', false); $p->PageCount = $zbp->managecount; $p->PageNow = (int) GetVars('page', 'GET') == 0 ? 1 : (int) GetVars('page', 'GET'); $p->PageBarCount = $zbp->pagebarcount; $p->UrlRule->Rules['{%category%}'] = GetVars('category'); $p->UrlRule->Rules['{%search%}'] = rawurlencode(GetVars('search')); $p->UrlRule->Rules['{%status%}'] = GetVars('status'); $p->UrlRule->Rules['{%istop%}'] = (bool) GetVars('istop'); $w = array(); if (!$zbp->CheckRights('ArticleAll')) { $w[] = array('=', 'log_AuthorID', $zbp->user->ID); } if (GetVars('search')) { $w[] = array('search', 'log_Content', 'log_Intro', 'log_Title', GetVars('search')); } if (GetVars('istop')) { $w[] = array('<>', 'log_Istop', '0'); } if (GetVars('status')) { $w[] = array('=', 'log_Status', GetVars('status')); } if (GetVars('category')) { $w[] = array('=', 'log_CateID', GetVars('category')); } $s = ''; $or = array('log_PostTime' => 'DESC'); $l = array(($p->PageNow - 1) * $p->PageCount, $p->PageCount); $op = array('pagebar' => $p); foreach ($GLOBALS['hooks']['Filter_Plugin_LargeData_Article'] as $fpname => &$fpsignal) { $fpreturn = $fpname($s, $w, $or, $l, $op); } $array = $zbp->GetArticleList( $s, $w, $or, $l, $op, false ); echo '<table border="1" class="tableFull tableBorder table_hover table_striped tableBorder-thcenter">'; $tables = ''; $tableths = array(); $tableths[] = '<tr>'; $tableths[] = '<th>' . $zbp->lang['msg']['id'] . '</th>'; $tableths[] = '<th>' . $zbp->lang['msg']['category'] . '</th>'; $tableths[] = '<th>' . $zbp->lang['msg']['author'] . '</th>'; $tableths[] = '<th>' . $zbp->lang['msg']['title'] . '</th>'; $tableths[] = '<th>' . $zbp->lang['msg']['date'] . '</th>'; $tableths[] = '<th>' . $zbp->lang['msg']['comment'] . '</th>'; $tableths[] = '<th>' . $zbp->lang['msg']['view'] . '</th>'; //添加第一行---浏览数 $tableths[] = '<th>' . $zbp->lang['msg']['status'] . '</th>'; $tableths[] = '<th></th>'; $tableths[] = '</tr>'; foreach ($array as $article) { $tabletds = array(); //table string $tabletds[] = '<tr>'; $tabletds[] = '<td class="td5">' . $article->ID . '</td>'; $tabletds[] = '<td class="td10">' . $article->Category->Name . '</td>'; $tabletds[] = '<td class="td10">' . $article->Author->Name . '</td>'; $tabletds[] = '<td><a href="' . $article->Url . '" target="_blank"><img src="../image/admin/link.png" alt="" title="" width="16" /></a> ' . $article->Title . '</td>'; $tabletds[] = '<td class="td20">' . $article->Time() . '</td>'; $tabletds[] = '<td class="td5">' . $article->CommNums . '</td>'; $tabletds[] = '<td class="td5">' . $article->ViewNums . '</td>'; //添加第二行 $tabletds[] = '<td class="td5">' . ($article->IsTop ? $zbp->lang['msg']['top'] . '|' : '') . $article->StatusName . '</td>'; $tabletds[] = '<td class="td10 tdCenter">' . '<a href="../cmd.php?act=ArticleEdt&id=' . $article->ID . '"><img src="../image/admin/page_edit.png" alt="' . $zbp->lang['msg']['edit'] . '" title="' . $zbp->lang['msg']['edit'] . '" width="16" /></a>' . ' ' . '<a onclick="return window.confirm(\'' . $zbp->lang['msg']['confirm_operating'] . '\');" href="' . BuildSafeCmdURL('act=ArticleDel&id=' . $article->ID) . '"><img src="../image/admin/delete.png" alt="' . $zbp->lang['msg']['del'] . '" title="' . $zbp->lang['msg']['del'] . '" width="16" /></a>' . '</td>'; $tabletds[] = '</tr>'; foreach ($GLOBALS['hooks']['Filter_Plugin_Admin_ArticleMng_Table'] as $fpname => &$fpsignal) { //传入 当前post,当前行,表头 $fpreturn = $fpname($article, $tabletds, $tableths); } $tables .= implode($tabletds); } echo implode($tableths) . $tables; echo '</table>'; echo '<hr/><p class="pagebar">'; foreach ($p->Buttons as $key => $value) { if ($p->PageNow == $key) { echo '<span class="now-page">' . $key . '</span> '; } else { echo '<a href="' . $value . '">' . $key . '</a> '; } } echo '</p></div>'; echo '<script type="text/javascript">ActiveLeftMenu("aArticleMng");</script>'; echo '<script type="text/javascript">AddHeaderIcon("' . $zbp->host . 'zb_system/image/common/article_32.png' . '");</script>';
转载请说明出处
zblog资源网 » zblog后台文章管理添加浏览数
zblog资源网 » zblog后台文章管理添加浏览数