O'Reilly logo

Yii Project Blueprints by Charles R. Portwood II

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Displaying and managing content

Now that Yii knows how to route our content, we can begin work on displaying and managing it. Begin by creating a new controller called ContentController in protected/controllers that extends CMSController. Have a look at the following line of code:

class ContentController extends CMSController {}

To start with, we'll define our accessRules() method and the default layout that we're going to use. Here's how:

public $layout = 'default'; public function filters() { return array( 'accessControl', ); } public function accessRules() { return array( array('allow', 'actions' => array('index', 'view', 'search'), 'users' => array('*') ), array('allow', 'actions' => array('admin', 'save', 'delete'), 'users'=>array('@'), 'expression' ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required