baodinzhihui/app/controller/Page.php

28 lines
935 B
PHP

<?php
namespace app\controller;
use app\model\{Category, Block};
class Page extends Base
{
public function index()
{
$categoryId=$this->request->param("category_id");
$category = Category::getById($this->request->param("category_id"));
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']);
}
}