本文整理匯總了PHP中common\models\Article::List_Articles方法的典型用法代碼示例。如果您正苦於以下問題:PHP Article::List_Articles方法的具體用法?PHP Article::List_Articles怎麽用?PHP Article::List_Articles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類common\models\Article
的用法示例。
在下文中一共展示了Article::List_Articles方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: cache404Page
/**
* 生成 404 靜態頁麵
* @author gaoqing
* @date 2016-04-20
* @param string $cacheKey 緩存的唯一標識
* @return boolean$generateFlag是否生成成功
*/
public static function cache404Page($cacheKey, $param = [], $forceCache = false)
{
$generateFlag = false;
$frontend = \Yii::getAlias('@frontend');
$page404FileName = $frontend . '/web/404.shtml';
if (!file_exists($page404FileName)) {
$forceCache = true;
}
if ($forceCache) {
$view = "404";
//獲取最新的資訊文章
$article = new Article();
$where = ' status=20';
$order = ' articleid DESC';
$lastestNews = $article->List_Articles($where, $order, 5, 0);
//獲取 疾病健康 文章
$darticle = new \common\models\disease\Article();
$lastestJibingArticle = $darticle->getLatestArticle(5, 0);
//精彩問答
$ask = new Ask();
$where1 = ' 1';
$order1 = ' id DESC';
$lastestAsk = $ask->getList($where1, $order1, 5, 0);
//字母部分
$letters = range('A', 'Z');
$condition = array('typeid' => array(0, 2, 3, 4, 5, 6, 7, 8, 9));
$rand_words = KeyWords::getCacheRandWords(100, $condition);
//熱門疾病、熱門部位
$commonDisDep = CacheHelper::getCache('frontend_article_detail_rmksbw_404', []);
$params = ['lastestNews' => $lastestNews, 'lastestJibingArticle' => $lastestJibingArticle, 'lastestAsk' => $lastestAsk, 'letters' => $letters, 'rand_words' => $rand_words, 'commonDisDep' => $commonDisDep, 'searchurl' => 'http://www.9939.com/zhuanti/'];
$controller = new BaseController('base404', null);
$controller->id = "base404";
$page404FilePath = $frontend . '/views/site';
$controller->viewPath = $page404FilePath;
$page404 = $controller->renderPartial($view, $params);
if (isset($page404) && !empty($page404)) {
if (file_put_contents($page404FileName, $page404)) {
$generateFlag = true;
}
}
}
return $generateFlag;
}