Actions and SiteController.php

Hi, it's me again. That annoying newbie…

I just want to clarify about actions and routes:

  1. I create a new page and put it in protected/site (i.e. about.php)

  2. I modify SiteController.php and add a new action (i.e. actionAbout() for an about page)

  3. I placed a link in my MainMenu.php and now it comes up.

My question is that the routing to views is not automatic? Do I have to declare EVERY view (with an action method) in SiteController.php?

Thanks in advance!

what do you mean by 'declare every view' ?

create an action, ie: actionAbout() and choose what to display:



public function actionAbout()


{


   // this will display /views/about/aboutFile.php


   $this->render('aboutFile');





   // or maybe just give a path to any file


   $this->render('../otherView/someFile.php');





   // or do anything with the view output


   mail('admin@domain.com', 'email', $this->render('about',null,true));


}


Please check this page: http://www.yiiframew…oc/cookbook/22/

Thanks folks. The cookbook page helped.