当前位置: 首页>>代码示例>>PHP>>正文


PHP Home::get_preview_summary方法代码示例

本文整理汇总了PHP中Home::get_preview_summary方法的典型用法代码示例。如果您正苦于以下问题:PHP Home::get_preview_summary方法的具体用法?PHP Home::get_preview_summary怎么用?PHP Home::get_preview_summary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Home的用法示例。


在下文中一共展示了Home::get_preview_summary方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_news_list

 public function get_news_list($start = 0, $limit = 10, $keyword, $type = 1)
 {
     $obj = new Home();
     $query = $this->news_model->get_news_list($type, $start, $limit, $keyword);
     if ($query != NULL) {
         $i = 0;
         foreach ($query->result() as $q) {
             $path = !isset($q->path_image) ? "" : $q->path_image;
             $title = !isset($q->title) ? "" : $q->title;
             $tag = !isset($q->tag) ? "" : $q->tag;
             $year = !isset($q->year) ? 0 : $q->year;
             $month = !isset($q->month) ? 0 : $q->month;
             $day = !isset($q->day) ? 0 : $q->day;
             $default = base_url('assets/img/news/default-image.png');
             $news_id = !isset($q->news_id) ? "" : $q->news_id;
             $read_more = base_url("news/read/" . $year . '/' . $month . '/' . $day . '/' . $news_id . "/" . $this->slug($title) . "");
             $title = $type == 2 || $type == 3 || $type == 4 ? $this->global_common->get_title(26, $title) : $title;
             $img = "<p><a class='crop' target='_blank' href='" . $read_more . "'>";
             //$img .= "<img class='img-responsive opacity' width='480px' src='". base_url($path) ."' alt='".$title."'/>";
             $img .= "<img class='img-responsive opacity lazy' width='480px' src='" . $default . "' data-original='" . base_url($path) . "'  alt='" . $title . "'>";
             $img .= "</a></p>";
             $category = !isset($q->category) ? "" : $q->category;
             $recent_news_category = "<a href='" . base_url('news/page/0/0/' . $category) . "'>" . $category . "</a>";
             $data[$i] = array("news_id" => $news_id, "news_category_id" => !isset($q->news_category_id) ? "" : $q->news_category_id, "image_id" => !isset($q->image_id) ? "" : $q->image_id, "title" => "<a href='" . $read_more . "'>" . $title . "</a>", "read_more" => "<a class='btn btn-primary' href='" . $read_more . "'>Read More</a>", "tag" => $this->global_common->get_list_tag($tag, 'news'), "summary" => !isset($q->summary) ? "" : $obj->get_preview_summary($q->summary), "body" => !isset($q->body) ? "" : $obj->get_preview_summary($q->body), "full_name" => !isset($q->nama_lengkap) ? "" : $q->nama_lengkap, "created_date" => !isset($q->created_date) ? "" : $q->created_date, "image" => $img, "recent_news_category" => $recent_news_category, "count_news_comment" => $this->news_model->count_news_comment($news_id)->count_news_comment, "count_news_stat" => $this->news_model->count_news_stat($news_id)->count_news_stat);
             $i++;
         }
     } else {
         $data = NULL;
     }
     return $data;
 }
开发者ID:kepoabiscom,项目名称:kepe-dev,代码行数:31,代码来源:news.php

示例2: result

 function result($type = 'article', $q)
 {
     $config = $this->page_config($type, $q);
     $result = $this->search_model->get($type, $q, $config['page'], $config['limit']);
     $home = new Home();
     $default = array(array("title" => "", "summary" => "", "url" => "", "no_result" => "<h2>No result.</h2>."));
     if ($result['data'] == false || $q == null) {
         return $default;
     } else {
         $counter = 0;
         foreach ($result['data'] as $row) {
             if ($row->status == 'published') {
                 $date = explode(" ", $row->created_date);
                 $y = explode("-", $date[0]);
                 $m = explode("-", $date[0]);
                 $d = explode("-", $date[0]);
                 if ($type == 'article') {
                     $url = base_url("article/read/" . $y[0] . '/' . $m[1] . '/' . $d[2] . '/' . $row->article_id . "/" . $this->slug($row->title) . "");
                 }
                 if ($type == 'news') {
                     $url = base_url("news/read/" . $y[0] . '/' . $m[1] . '/' . $d[2] . '/' . $row->news_id . "/" . $this->slug($row->title) . "");
                 }
                 if ($type == 'video') {
                     $url = base_url('video/watch/' . $y[0] . '/' . $m[1] . '/' . $d[2] . '/' . $row->video_id . '/' . $this->slug($row->title));
                 }
                 $data[] = array("title" => $this->get_highlight($row->title, $q), "summary" => $type != 'video' ? strip_tags($home->get_preview_summary($this->get_highlight($row->summary, $q), $url, ''), '<a></a>') : strip_tags($home->get_preview_summary($this->get_highlight($row->description, $q), $url, 'video'), '<a></a>'), "url" => $url, "no_result" => "");
                 $counter++;
             }
         }
         return $counter > 0 ? $data : $default;
     }
 }
开发者ID:kepoabiscom,项目名称:kepe-dev,代码行数:32,代码来源:search.php


注:本文中的Home::get_preview_summary方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。