Now, we're ready to start displaying content. To get started, we create a new controller called SiteController.php
in the protected/controllers
directory that contains the following:
<?php class SiteController extends CController { public function actionIndex() { $this->render('index'); } }
Next, let's create our main layout in protected/views/layouts/main.php
. For simplicity, we're once again going to use the jQuery and Twitter Bootstrap styles from publicly available CDNs, as follows:
<!DOCTYPE html> <html> <head> <title><?php echo CHtml::encode(Yii::app()->name); ?></title> <?php Yii::app()->clientScript ->registerMetaTag('text/html; charset=UTF-8', 'Content-Type') ->registerCssFile( '//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css' ) ->registerScriptFile( 'https://code.jquery.com/jquery.js...