Changes in the SiteController.php:
Add
1:2: public function actionOperators()3: {4: $emodel=new OperatorModel;5:6: $model->Name = "zvika";7:8: // display the login form9: $this->render('pages/Operators',array('model'=>$model));10: }
The simple operator view:
1: <?php2: /* @var $this SiteController */3:4: $this->pageTitle=Yii::app()->name . ' - Operators';5: $this->breadcrumbs=array(6: 'Operators',7: );8: ?>9: <h1>Operators</h1>10:11: <?php echo $model->Name; ?>12:13: <?php echo CHtml::activeLabel($model,'Name'); ?>14:
The operator model
Add the menu item to the main.php
1: <div id="mainmenu">2: <?php $this->widget('zii.widgets.CMenu',array(3: 'items'=>array(4: array('label'=>'Home', 'url'=>array('/site/index')),5: array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),6: array('label'=>'Operators', 'url'=>array('/site/Operators')),7: array('label'=>'Contact', 'url'=>array('/site/contact')),8: array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),9: array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest)10: ),11: )); ?>
אין תגובות:
הוסף רשומת תגובה