예제 #1
0
$news = new Newses();
$tag = new Tags();
$conditions = array();
$viewhelper->setTitle(L("info", "tpl"));
$viewhelper->setPosition(L("info", "tpl"), "news/");
if (isset($_GET['title'])) {
    $title = rawurldecode(trim($_GET['title']));
    $res = $news->findByTitle($title);
    $id = $res['id'];
}
if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
}
if (!empty($id)) {
    require CACHE_PATH . "cache_type.php";
    $news->clicked($id);
    $info = $news->read("*", $id);
    if (empty($info) or !$info) {
        flash("data_not_exists", '', 0);
    }
    if (!empty($info['tag_ids'])) {
        $tag->getTagsByIds($info['tag_ids'], true);
        $info['tag'] = $tag->tag;
    }
    if (!empty($info['picture'])) {
        $info['image'] = pb_get_attachmenturl($info['picture'], '', 'small');
    }
    $info['pubdate'] = df($info['created']);
    $info['typename'] = $_PB_CACHE['newstype'][$info['type_id']];
    $viewhelper->setTitle($info['typename']);
    $viewhelper->setPosition($info['typename'], "news/list.php?typeid=" . $info['type_id']);