noumo / easyii

Easy yii2 cms powered by Yii framework 2
http://easyiicms.com
593 stars 272 forks source link

Page controller missing #181

Open izemize opened 7 years ago

izemize commented 7 years ago

PageController.php

<?php
namespace app\controllers;

use yii\easyii\modules\page\api\Page;

class PageController extends \yii\web\Controller
{
    public function actionView($slug)
    {
        $item = Page::get($slug);
        if(!$item){
            throw new NotFoundHttpException('Item not found.');
        }

        return $this->render('view', [
            'item' => $item,
        ]);
    }
}

page/view.php

<?php
use yii\helpers\Url;

$this->title = $item->seo('title', $item->model->title);
$this->params['breadcrumbs'][] = ['label' => 'Statikus oldalak', 'url' => ['news/index']];
$this->params['breadcrumbs'][] = $item->model->title;
?>
<h1><?= $item->seo('h1', $item->title) ?></h1>

<?= $item->text ?>