Exemple #1
0
 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;
 }
Exemple #2
0
 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;
 }
Exemple #3
0
 function slug($str = '')
 {
     $home = new Home();
     return $home->slug($str);
 }