Noob QnA

I am a complete Yii noob and I have a few very noob questions. Any answers would be much appreciated:

First up, static pages:

Say, for example I want to make a static page, which doesn’t use the database at all, I make a page under: protected/views/site/pages, correct? Do I have to define what layout that page will use? If I don’t want to use the standard layout, or I want to use an alternative style sheet, how do I do that? Also, when I am linking to the static page, what is the correct syntax?

Next question, passing and retrieving variables.

Lets pretend I have two pages, on pageA I have a textfieldcalled number( is this correct? <?php echo CHtml::textfield(‘number’,$number); ?>), as well as a submit button. Now, I want to pass the variable to a second page, pageB, which will simply display the number entered in the textfield. How do I do that?

Also, what if I want to work with the variable before it is displayed, for example, I want to simply add 5 to the number entered, how do I do that?

Next question - Recordsets

Now, lets pretend I have a drop down menu which I want to fill with entries from the database, how do i do that? Where (and how) do I create a recordset? Now, lets pretend that the table in the database from where the records for the drop down menu are retrieved has the structure ID, name, age; where age name is the records populating the drop down menu. How do I then (on the next page) recover the corresponding age for the name sent by the form.

I’m sorry these are really noob questions, but I am really struggling to understand the way in which Yii is used. It just isn’t making any sense? I have done the blog tutorial, but that seems to be for an older version of Yii and doesn’t work “out the box” correctly. Also it is just basically copying and pasting with very very little explanation.

Again, I apologize for these questions, but Yii is frustrating me. Please try explain to me in simple english!

Thanks Yii People

first, static pages

http://www.yiiframework.com/doc/cookbook/22/

when using urlmanager, create a rule like this:




'rules' => array(

    '<view:(about|imprint)>' => 'site/page'

),



in your view create a link to your about-page:




echo CHtml::link('About', array('site/page', 'view' => 'about'));



second, retrieving variables




public function actionTest

{

    //retrieve the number from a post request

    $number = intval(Yii::app()->request->getPost('number', 0));

    //or from GET

    $number = intval(Yii::app()->request->getQuery('number', 0));

    //or from REQUEST in general

    $number = intval(Yii::app()->request->getParam('number', 0));


    //pass vars to the view

    $this->render('test', compact('number'));

}



third, a drop down




echo CHtml::activeDropDownList($model, 'attribute', CHtml::listData(Post::model()->findAll(), 'id', 'title'));



legend