Reusing controllers for different urls


I would like to ‘divide’ my site on say three areas. Each of those is structurally identical to any other two, what’s different is the content. I would like urls:




to be processed by the same controller’s index action. While processing request in index I would like to know in which section I am, 1,2 or 3. Also, as user (I) continues to use the interface (ex. clicks links) that is common between sections, I need to know in which section I am.

I first thought that maybe going to ex. \http://myhost/section1 should set some kind of session variable, but this feels obscure (at least to me;). Maybe someone could help me a little bit. Any ideas appreciated

You can create 3 modules, one for each section.

If the controller are so similar, you can implement a master controller and extend it in each module.

take a look to the class Controller, auto generated by yii webapp.

I think I’ve found a solution to this here: -> URL Management -> Parameterizing Hostnames

Thanks for this fantastic framework!:)

Thanks zaccaria!

Ok, i am a little bit ignorant. Your solution seems to be what I’m looking for. More on this here:

Again, thanks