public function run($chnid) { $currentChannel = $this->getChannel($chnid); $query = DataSource::buildContentQuery($currentChannel['table'], [], 'channel_id=' . $chnid); $locals = LuLu::getPagedRows($query); $locals['chnid'] = $chnid; $locals['currentChannel'] = $currentChannel; $locals['currentModel'] = $currentChannel['table']; $view = LuLu::getView(); $view->setTitle(empty($currentChannel['seo_title']) ? $currentChannel['name'] : $currentChannel['seo_title']); $view->setMetaTag('keywords', $currentChannel['seo_keywords']); $view->setMetaTag('description', $currentChannel['seo_description']); $listTpl = $this->getTpl($chnid, 'list_tpl'); return $this->render($listTpl, $locals); }
public function run($chnid = 0, $id) { $currentChannel = $this->getChannel($chnid); $this->currentTableName = $currentChannel['table']; $this->updateViews($id); $model = $this->findModel($id); $locals = []; $locals['model'] = $model; $locals['chnid'] = $chnid; $locals['currentChannel'] = $currentChannel; $locals['currentModel'] = $currentChannel['table']; $view = LuLu::getView(); $view->setTitle($model['title']); $view->setMetaTag('keywords', $model['title']); $view->setMetaTag('description', $model['summary']); $detailTpl = $this->getTpl($chnid, 'detail_tpl'); return $this->render($detailTpl, $locals); }
public function run($chnid = 0) { $currentChannel = $this->getChannel($chnid); $childChannels = $this->getChildChannels($chnid); $dataList = []; foreach ($childChannels as $channel) { $dataList[$channel['id']] = DataSource::getContentByChannel($channel['id'], ['limit' => 5]); } $locals = []; $locals['dataList'] = $dataList; $locals['chnid'] = $chnid; $locals['currentChannel'] = $currentChannel; $locals['currentModel'] = $currentChannel['table']; $view = LuLu::getView(); $view->setTitle(empty($currentChannel['seo_title']) ? $currentChannel['name'] : $currentChannel['seo_title']); $view->setMetaTag('keywords', $currentChannel['seo_keywords']); $view->setMetaTag('description', $currentChannel['seo_description']); $channelTpl = $this->getTpl($chnid, 'channel_tpl'); return $this->render($channelTpl, $locals); }
public function actionDetail($id) { $view = LuLu::getView(); $model = $this->findModel($id); $view->setTitle(empty($model['seo_title']) ? $model['title'] : $model['seo_title']); $view->setMetaTag('keywords', $model['seo_keywords']); $view->setMetaTag('description', $model['seo_description']); $view->addBreadcrumb('页面', ['page/index']); $category = PageCategory::findOne($model->category_id); if ($category !== null) { $view->addBreadcrumb($category['name'], ['page/index', 'catid' => $category['id']]); } $view->addBreadcrumb($model['title']); $locals = []; $locals['model'] = $model; $locals['catid'] = $model->category_id; $locals['currentCategory'] = $category; $detailTpl = $this->getDetailTpl($model['tpl']); return $this->render($detailTpl, $locals); }
private function setSeo() { $view = LuLu::getView(); $title = CommonUtility::getCachedConfigValue('seo_title'); if (empty($title)) { $title = '首页——' . CommonUtility::getCachedConfigValue('seo_name'); } $view->setTitle($title); $view->registerMetaTag(['name' => 'keywords', 'content' => CommonUtility::getCachedConfigValue('seo_keywords')]); $view->registerMetaTag(['name' => 'description', 'content' => CommonUtility::getCachedConfigValue('seo_description')]); }