本文整理汇总了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");
}
示例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;
}
示例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();
}
示例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();
}