New to Yii, I started playing around with it today.. anyways.. I am trying to figure out
a routing issue that I have… well its really NOT an issue but more of a concern. Currently reading the routing documentation lead me to modify the rules exactly how I want them to be (removing index.php, site controller, etc). Here is how I have the rules set.
now as you can see I have a rule for the view like <view:(about)>. My initial question is… what if I had like 50 static pages… how would I turn this in a way that I don’t have to physically insert each and every single static page inside the rules regular expression?
Instead of defining exceptions before your general action rule maybe add a filter that would fire before any action in the Site controller and check if the action id is on a list of static pages, then render it instead.
nineinchnick, would you mind throwing me on the correct path? I found a whole bunch of stuff, and I don’t want to move forward till I can fully understand this section.
I looked through the CController code and I think you can:
override missingAction() method where you would check if action is a static page and redirect there/display it, in other cases call the parent implentation
define all static pages in the actions() method, remember that it’s a method and you don’t have to return a static array, you can build it there
create a widget that would scan the location of your static pages and return them as array in its actions() method, this makes it an action provider widget
use the CViewAction widget
create a distinctive url route in the manager - as ORey suggested, this looks like the easiest way