/** * News detail * * @access public * @return Response */ public function get_detail($slug = null) { $cols = array('news.id', 'news.news_category_id', 'news.title', 'news.body', 'news.format', 'news.published_at', 'news.slug', array('news_category.name', 'news_category_name'), array('news_category.label', 'news_category_label')); $query = \DB::select_array($cols)->from('news')->join('news_category', 'LEFT')->on('news_category.id', '=', 'news.news_category_id')->where('slug', $slug)->and_where('is_published', 1); if (!($response = $query->execute()->current())) { throw new \HttpNotFoundException(); } $response['body'] = convert_body_by_format($response['body'], $response['format']); unset($response['format']); $cols = array('news_image.name', array('file.name', 'file_name'), array('file.type', 'file_type')); $query = \DB::select_array($cols)->from('news_image')->join('file', 'LEFT')->on('file.name', '=', 'news_image.file_name')->where('news_id', $response['id']); $response['images'] = self::add_file_options($query->execute()->as_array(), 'img'); $cols = array('news_file.name', array('file.name', 'file_name'), array('file.original_filename', 'file_original_filename'), array('file.type', 'file_type')); $query = \DB::select_array($cols)->from('news_file')->join('file', 'LEFT')->on('file.name', '=', 'news_file.file_name')->where('news_id', $response['id']); $response['files'] = self::add_file_options($query->execute()->as_array(), 'file'); $cols = array('uri', 'label'); $query = \DB::select_array($cols)->from('news_link')->where('news_id', $response['id']); $response['links'] = $query->execute()->as_array(); if (\Config::get('news.tags.isEnabled')) { $cols = array('tag.name'); $query = \DB::select_array($cols)->from('news_tag')->join('tag', 'LEFT')->on('tag.id', '=', 'news_tag.tag_id')->where('news_id', $response['id']); $response['tags'] = $query->execute()->as_array(); } return $this->response($response); }
<div class="article"> <div class="row"> <div class="col-<?php echo $col_class; ?> -<?php echo 12 - $image_col_size; ?> "> <h4 class="media-heading"> <?php echo Html::anchor('news/detail/' . $news->slug, strim($news->title, $title_trim_width)); ?> </h4> <?php echo convert_body_by_format($html_bodys[$id], $body_format, $body_trim_width, 'news/detail/' . $news->slug); ?> </div> <?php if ($image_col_size) { ?> <div class="col-<?php echo $col_class; ?> -<?php echo $image_col_size; ?> article-left"> <div class="imgBox"> <?php echo img($image->file_name, 'thumbnail', 'news/detail/' . $news->slug, false, '', false, true, array('class' => 'thumbnail'));
<div class="article_body"> <?php echo convert_body_by_format($html_body, $news->format); ?> </div> <?php if (!conf('image.isInsertBody', 'news')) { echo render('_parts/thumbnails', array('is_display_name' => true, 'images' => array('list' => $images, 'file_cate' => 'nw', 'size' => 'M', 'column_count' => 3))); } echo render('_parts/file_links', array('title' => term('site.file'), 'list' => $files, 'file_cate' => 'nw', 'split_criterion_id' => $news->id)); echo render('_parts/links', array('title' => term('site.link'), 'list' => $news->news_link)); ?> <?php if (Config::get('news.tags.isEnabled') && $tags) { echo render('_parts/tags', array('tags' => $tags)); } ?>
<div class="article_body"> <?php echo convert_body_by_format($html_body, $content_page->format); ?> </div>