本文整理汇总了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;
}