當前位置: 首頁>>代碼示例>>PHP>>正文


PHP News::get_item方法代碼示例

本文整理匯總了PHP中News::get_item方法的典型用法代碼示例。如果您正苦於以下問題:PHP News::get_item方法的具體用法?PHP News::get_item怎麽用?PHP News::get_item使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在News的用法示例。


在下文中一共展示了News::get_item方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: draw

 function draw()
 {
     global $display;
     $id = intval(Url::get('id', 0));
     if (!empty($id)) {
         $item = News::get_item($id);
     }
     if (empty($item)) {
         Url::redirect_url('/tin-tuc.html');
         exit;
     }
     if (!empty($item)) {
         if (!empty($item['category_id'])) {
             $categories = NewsCategory::get_by_ids($item['category_id']);
         }
         if ($item['is_active'] == 0) {
             Url::redirect_url('/tin-tuc.html');
             exit;
         }
         if ($item['uid'] > 0) {
             $author = User::getUserById($item['uid']);
             // var_dump($author);die;
             if ($author['full_name'] == '') {
                 $item['author'] = $author['user_name'];
             } else {
                 $item['author'] = $author['full_name'];
             }
         }
         $item['view'] += 1;
         News::update_view(array('view' => $item['view']), 'id=' . $id);
     }
     $tags = News::render_tags($item['keywords']);
     $related_items = NewsCategory::get_top_news($item['category_id'], 4);
     if (count($related_items > 0)) {
         foreach ($related_items as $key => $value) {
             // $list_news[$key]['title'] = Util::split_char($value['title'],40,-1) . ' ...';
             if ($value['uid'] > 0) {
                 $author = User::getUserById($value['uid']);
                 // var_dump($author);die;
                 if ($author['full_name'] == '') {
                     $related_items[$key]['author'] = $author['user_name'];
                 } else {
                     $related_items[$key]['author'] = $author['full_name'];
                 }
             }
         }
     }
     $display->add('roots', NewsCategory::get_categories());
     $display->add('item', $item);
     $display->add('tags', $tags);
     $display->add('related_items', $related_items);
     $display->add("categories", $categories);
     $display->output("Detail");
 }
開發者ID:hqd276,項目名稱:bigs,代碼行數:54,代碼來源:detail.php

示例2: show_detail

 function show_detail()
 {
     header('Content-Type: text/html; charset=utf-8');
     global $display;
     $id = intval(Url::get('id', 0));
     if (!empty($id)) {
         $item = News::get_item($id);
     }
     $display->add('item', $item);
     $display->output('CmsNews/ajax/ShowDetail');
     exit;
 }
開發者ID:hqd276,項目名稱:bigs,代碼行數:12,代碼來源:ajax_news.ajax.php

示例3: draw

 function draw()
 {
     global $display;
     $item_id = intval(Url::get('id', 0));
     $this->beginForm(true, 'post', false, Url::build_current(array("cmd" => "edit", "id" => $item_id)));
     $item = array();
     // Get Data
     if ($item_id) {
         $item = News::get_item($item_id);
     }
     $display->add('item', $item);
     $display->add('error_message', $this->getErrorMessage('news/item/error'));
     $display->add('success_message', $this->getSuccessMessage('news/item/success'));
     $display->output('Edit');
     $this->endForm();
 }
開發者ID:hqd276,項目名稱:bigs,代碼行數:16,代碼來源:edit.php

示例4: draw

 function draw()
 {
     global $display;
     $this->beginForm(true, 'post', false, Url::build_current());
     $item_id = intval(Url::get('id', 0));
     $cid = intval(Url::get('cid', 0));
     if (!empty($cid)) {
         $display->add('cid', $cid);
     }
     $item = array();
     // Get Data
     if ($item_id) {
         $item = News::get_item($item_id);
     }
     $display->add('item', $item);
     $display->add('categories', NewsCategory::get_categories());
     $display->add('error_message', $this->getErrorMessage('news/item/error'));
     $display->add('success_message', $this->getSuccessMessage('news/item/success'));
     $display->output('Detail');
     $this->endForm();
 }
開發者ID:hqd276,項目名稱:bigs,代碼行數:21,代碼來源:detail.php


注:本文中的News::get_item方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。