Undefined variable issue on the first Yii app.
Posted 10 February 2009 - 10:58 PM
I am getting the error: Undefined variable: pages
in file: /home/developer/yii-first/protected/views/user/list.php(
Referring to line 8: 00008: $this->widget('CLinkPager',array('pages'=>$pages));
This is on the home page. The home page is fine as soon as I revert /protected/views/site/index.php back to how it was originally.
Posted 11 February 2009 - 06:21 PM
I have just followed the installation at:
Running yiic webapp (from which the basic template site runs ok)
Modifying /protected/config/main.php to include the database parameters
Created the database and User table.
Running 'model User' and 'crud User'
The site works at each step along here fine.
I didn't see any mention of changing SiteController.php
From this base install I started following the tutorial here: http://www.yiiframew...doc/cookbook/5/ but at the first step of replacing the contents of file /protected/views/site/index.php created the 'undefined variable: page' error.
Posted 11 February 2009 - 11:22 PM
The cookbook page does not apply to what?
The cookbook example that I am trying needs User and User needs $pages. It seems that there is a step I overlooked somewhere that I cannot find.
Edit: I looked into UserController::actionList() but wasn't sure what to do. I am just starting out with Yii and I have read through the definitive guide but am trying to learn from from these exercises so am quite naive at this time.
Posted 12 February 2009 - 06:47 AM
I recommend you follow the blog demo to learn Yii, instead of cookbook. The latter is meant to solve individual problem that you encounter during your development.