chaoyu/app/controller/Page.php

32 lines
988 B
PHP

<?php
namespace app\controller;
use app\model\{Category, Block};
class Page extends Base
{
private function getPageCommonData($categoryId)
{
$resp = true;
return $resp;
}
// 默认单页页面
public function index($categoryId)
{
$category = Category::getById($categoryId);
if ($category) {
$description = $category['description'] ? $category['description'] : $this->system['seo_description'];
$this->setSeo($category['title'], $this->system['seo_keywords'], $description);
} else {
return $this->error('页面错误');
}
$childCategory = Category::getChildrenByParentId($categoryId);
$this->data['categoryId'] = $categoryId;
$this->data['category'] = $category;
$this->data['childCategory'] = $childCategory;
$this->data['blocks'] = Block::getByCategoryId($categoryId);
return $this->view($category['template_detail']);
}
}