本文整理匯總了PHP中ContentModel::Month_Rec方法的典型用法代碼示例。如果您正苦於以下問題:PHP ContentModel::Month_Rec方法的具體用法?PHP ContentModel::Month_Rec怎麽用?PHP ContentModel::Month_Rec使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ContentModel
的用法示例。
在下文中一共展示了ContentModel::Month_Rec方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Show_Month
private function Show_Month()
{
global $templates;
$content = new ContentModel();
$content->id = $_GET['id'];
$parid = $content->Get_Par_Id();
$content->nav = $parid->nav;
//列出本月推薦
$object_rec = $content->Month_Rec();
if ($object_rec) {
foreach ($object_rec as $value) {
$value->title = Tool::Sub_Str($value->title, 15);
$value->date = date('m-d', strtotime($value->date));
//將時間格式轉換一下
}
}
$templates->assgin('Month_Rec', $object_rec);
//注入模板,顯示本月推薦
//列出本月熱點
$object_hot = $content->Month_Hot();
if ($object_hot) {
foreach ($object_hot as $value) {
$value->title = Tool::Sub_Str($value->title, 15);
$value->date = date('m-d', strtotime($value->date));
//將時間格式轉換一下
}
}
$templates->assgin('Month_Hot', $object_hot);
//注入模板,顯示本月熱點
//列出本月圖文(含有圖片的wenzha)
$object_pic = $content->Month_Pic();
if ($object_pic) {
foreach ($object_pic as $value) {
$value->title = Tool::Sub_Str($value->title, 15);
$value->date = date('m-d', strtotime($value->date));
//將時間格式轉換一下
}
}
$templates->assgin('Month_pic', $object_pic);
//注入模板,顯示本月熱點
}
示例2: Get_Contentlist
private function Get_Contentlist()
{
global $templates;
$content = new ContentModel();
$nav = new NavModel();
$nav->id = $_GET['id'];
$object_child = $nav->selectchildNav_nolimit();
//根據父導航ld找到子導航
foreach ($object_child as $value_child) {
$id[] = $value_child->id;
}
if ($object_child) {
$in = implode(',', $id);
$content->nav = $in;
//sQL語句中IN關鍵字
} else {
$content->nav = $_GET['id'];
}
$countArr = $content->Get_Contentlist();
$count = $countArr->c;
//得到記錄數
$page = new Page($count, PAGE_SIZE);
$content->limit = $page->limit;
//注入limit值
$templates->assgin('page', $page->Show_Page_Num());
//顯示分頁
$object = $content->Get_Content();
//獲取所有的content
foreach ($object as $value) {
$value->title = Tool::Sub_Str($value->title, 15);
//對title進行截取
$value->info = Tool::Sub_Str($value->info, 120);
//對info進行截取
if (empty($value->thumbnail)) {
$value->thumbnail = 'images/none.jpg';
}
}
$templates->assgin('AllContent', $object);
//注入模板,顯示content
//列出本月推薦
$object_rec = $content->Month_Rec();
if ($object_rec) {
foreach ($object_rec as $value) {
$value->title = Tool::Sub_Str($value->title, 15);
$value->date = date('m-d', strtotime($value->date));
//將時間格式轉換一下
}
}
$templates->assgin('Month_Rec', $object_rec);
//注入模板,顯示本月推薦
//列出本月熱點
$object_hot = $content->Month_Hot();
if ($object_hot) {
foreach ($object_hot as $value) {
$value->title = Tool::Sub_Str($value->title, 15);
$value->date = date('m-d', strtotime($value->date));
//將時間格式轉換一下
}
}
$templates->assgin('Month_Hot', $object_hot);
//注入模板,顯示本月熱點
//列出本月圖文(含有圖片的wenzha)
$object_pic = $content->Month_Pic();
if ($object_pic) {
foreach ($object_pic as $value) {
$value->title = Tool::Sub_Str($value->title, 15);
$value->date = date('m-d', strtotime($value->date));
//將時間格式轉換一下
}
}
$templates->assgin('Month_pic', $object_pic);
//注入模板,顯示本月熱點
}