本文整理汇总了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;
}
示例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;
}
示例3: slug
function slug($str = '')
{
$home = new Home();
return $home->slug($str);
}