zzwy2/app/controller/Position.php

44 lines
1.3 KiB
PHP
Executable File

<?php
namespace app\controller;
use app\model\{Block, Category, PositionModel};
use think\Paginator;
class Position extends Base
{
//详情
public function detail($id = 0)
{
if ($id <= 0) {
return $this->error('错误页面');
}
$article = PositionModel::getById($id);
if (empty($article)) {
return $this->error('无此内容');
}
$category = Category::getById($article['category_id']);
$description = $category['seo_description'] ?: $this->system['seo_description'];
$keywords = $category['seo_keywords'] ?: $this->system['seo_keywords'];
$title = $category['seo_title'] ?: $category['title'].' | '.$this->system['seo_title'];
$this->setSeo($title, $keywords, $description);
$this->data['item'] = $article;
$this->data['category'] = $category;
$blocks = Block::getByCategoryId($category['id']);
$blocks = Block::convertValue($blocks);
$this->data['blocks'] = $blocks;
$this->data['categoryId'] = $category['id'];
$this->data['topCategoryId'] = Category::firstGradeById($category['id']) ;
return $this->view('/article/joindata');
}
}