how to use dataProvider result inside the actionView function it self




	public function actionView($id)

	{

		$pageDataProvider = new CActiveDataProvider('Page', array(

			'criteria'=>array(

				'condition'=>'id='.$id,

				),

		));

		

		echo "page layout: ".$pageDataProvider->layout;

		

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

			'model'=>$this->loadModel($id),

			'pageDataProvider'=>$pageDataProvider,

		));

	}



you see what I am trying to do




echo "page layout: ".$pageDataProvider->layout;



its not working ofc, error:

Property "CActiveDataProvider.layout" is not defined.

Can anyone help me with this, how do I get some data out of $pageDataProvider directly in the function it self and not the view?

What data do you need? If you want an array of found models, then use:




$pageDataProvider->getData();



CActiveDataProvider::getData() always returns an array of objects. There are no benefits to using dataprovider when you want to retrieve a single record by its primary key. Just use




Page::model()->findByPk($id)