How To Access Modal Variables In Index View (Actionindex)

I am new to yii and am working through the book Web Application Development with Yii and PHP to create a project tracking system.

The modals, controllers and views (CRUD functionality) have been created with the Gii tool.

The IssueController renders a CActiveDataProvider for the index view. The index view displays a couple of menu items and then displays the CActiveDataProvider in a CListView widget.

What I would like to do is include a modal variable in the menu items in the index view but the modal is not defined. So I am wondering how you would go about defining the modal. I assume that it needs to be defined in the IssueContoller actionIndex and passed through to the index view?

I am sure this is very obvious but I am still learning Yii and the fundamentals of OOP. Any help would be greatly appreciated.

IssueController actionIndex


public function actionIndex()

	{

		$dataProvider=new CActiveDataProvider('Issue', array(

			'criteria'=>array(

				'condition'=>'project_id=:projectId',

				'params'=>array(':projectId'=>$this->_project->id),

				),

		));

		$this->render('index',array(

			'dataProvider'=>$dataProvider,

		));

	}

index view


<?php

/* @var $this IssueController */

/* @var $dataProvider CActiveDataProvider */


$this->breadcrumbs=array(

	'Issues',

);


$this->menu=array(

	array('label'=>'Create Issue', 'url'=>array('create')),

	array('label'=>'Manage Issue', 'url'=>array('admin')),

);

echo $dataProvider->product_id;

?>


<h1>Issues</h1>


<?php $this->widget('zii.widgets.CListView', array(

	'dataProvider'=>$dataProvider,

	'itemView'=>'_view',

)); ?>



I worked out a couple of ways of doing it and the one I went with is below.


public function actionIndex($pid)

	{

		$dataProvider=new CActiveDataProvider('Issue', array(

			'criteria'=>array(

				'condition'=>'project_id=:projectId',

				'params'=>array(':projectId'=>$this->_project->id),

				),

		));

		$this->render('index',array(

			'dataProvider'=>$dataProvider,

			'model'=>$this->loadProject($pid),

		));

	}

I believe the $pid parameter is being populated by automatic action parameter binding as detailed here.

loadProject is a method in the IssueController that returns the project data model based on the primary key given.