Wrapping Controller actions to an array?

Hi,

I’m making own Yii based CMS. I faced a little problem with creation of new pages via my CMS.

At this point, to make new page, my CMS php code writes some additional rows to SiteController.php, like

this:




public function actionPageName()

{

      $this->render("pageName");

}




And also creates new view page like - pageName.php.

And now I’m afraid that writing extra lines to SiteController is quite erratic option. I mean if you want

to delete an action or occasianally write some pages with same name twice, always an error will be result and this CMS needs to be pretty stable. For sure I have write some code and if-clauses to prevent errors, but it seems to be pretty unstable still.

So, I’m thinking to make this kind of dynamic page stucture. SiteController would some way get an array of pages like this:




array(

    page1 => page1, // (action is page1, render page1)

    page2 => page2,  

    page3 => page3,

);



and so on. So SiteController would get an array when it comes to new pages, it finds page which should be rendered in that array.

Could you give some comments about the idea and even I would be pretty thankfully to get help about how to do that if it is the best way(and possible way) to solve the problem?