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


PHP Home::slug方法代码示例

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


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

示例1: sitemap

 function sitemap($t)
 {
     $result = $this->sitemap_model->get_url_sitemap($t);
     $home = new Home();
     if ($result != false) {
         foreach ($result as $row) {
             $date = explode(" ", $row->created_date);
             $y = explode("-", $date[0]);
             $m = explode("-", $date[0]);
             $d = explode("-", $date[0]);
             if ($t == 'article') {
                 $url = base_url("article/read/" . $y[0] . '/' . $m[1] . '/' . $d[2] . '/' . $row->article_id . "/" . $home->slug($row->title) . "");
             }
             if ($t == 'news') {
                 $url = base_url("news/read/" . $y[0] . '/' . $m[1] . '/' . $d[2] . '/' . $row->news_id . "/" . $home->slug($row->title) . "");
             }
             if ($t == 'video') {
                 $url = base_url("video/watch/" . $y[0] . '/' . $m[1] . '/' . $d[2] . '/' . $row->video_id . "/" . $home->slug($row->title) . "");
             }
             $datetime = new DateTime($row->created_date);
             $data[] = array("loc" => $url, "lastmod" => $datetime->format('Y-m-d\\TH:i:sP'), "priority" => 0.5, "changefreq" => "daily");
         }
     }
     return $data;
 }
开发者ID:kepoabiscom,项目名称:kepe-dev,代码行数:25,代码来源:sitemap.php

示例2: get_article_list

 public function get_article_list($start = 0, $limit = 10, $keyword, $type = 1)
 {
     $obj = new Home();
     $query = $this->article_model->get_article_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;
             $article_id = !isset($q->article_id) ? "" : $q->article_id;
             $read_more = base_url("article/read/" . $article_id . "/" . $obj->slug($title) . "");
             $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/article/default-image.png');
             $article_id = !isset($q->article_id) ? "" : $q->article_id;
             $read_more = base_url("article/read/" . $year . '/' . $month . '/' . $day . '/' . $article_id . "/" . $this->slug($title) . "");
             $title = $type == 2 || $type == 3 || $type == 4 ? $this->global_common->get_title(26, $title) : $title;
             $img = "<p><a 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_article_category = "<a href='" . base_url('article/page/0/0/' . $category) . "'>" . $category . "</a>";
             $data[$i] = array("article_id" => $article_id, "article_category_id" => !isset($q->article_category_id) ? "" : $q->article_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, 'article'), "summary" => !isset($q->summary) ? "" : $obj->get_preview_summary($q->summary), "full_name" => !isset($q->nama_lengkap) ? "" : $q->nama_lengkap, "created_date" => !isset($q->created_date) ? "" : $q->created_date, "image" => $img, "recent_article_category" => $recent_article_category, "count_article_comment" => $this->article_model->count_article_comment($article_id)->count_article_comment, "count_article_stat" => $this->article_model->count_article_stat($article_id)->count_article_stat);
             $i++;
         }
     } else {
         $data = NULL;
     }
     return $data;
 }
开发者ID:kepoabiscom,项目名称:kepe-dev,代码行数:33,代码来源:article.php

示例3: slug

 function slug($str = '')
 {
     $home = new Home();
     return $home->slug($str);
 }
开发者ID:kepoabiscom,项目名称:kepe-dev,代码行数:5,代码来源:search.php


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