Url Manager to decode string url

Hello all,

I want to render one specifically page -configured dinamically by the user- as the homepage of a site, it means that if the user has set up as homepage the page at "/page/4/pagetitle" (www.mysite.com/page/4/pagetitle) when I go to (www.mysite.com) I want to render the content of the url at "/page/4/pagetitle".

I have the url ("/page/4/pagetitle") configured by the user and stored in my DB, then in the site/index action of my site I want to use the UrlManager to extract what controller/action and request parameters correspond to this url ("/page/4/pagetitle") so that I can invoke it later, but I cannot use the parseUrl method because it requires a CHttpRequest and ¿I cannot? construct one with my url.

I don’t want to do a redirect because then when I go to the homepage I would redirect at www.mysite.com/page/4/pagetitle and the user would not see www.mysite.com at the address bar at the browser. I obviously don’t want to use iframes neither. And I dont want to extract the contents of the /page/4/pagetitle page and render it, to be able to extends to categories (/category/5/categorytitle), or tags pages in the future.

How can I get the controller/action and request parameters from a string url ("/page/4/pagetitle" or "www.mysite.com/page/4/pagetitle")?

Thanks in advance:


If the visitor goes to www.mysite.com, how will you know that you have to use exactly the page 4?

Maybe you write in db what page is the index, so you don’t need to use url manager, simply retrive from database the page and render it.

Yes, I store it in DB, but I want to render any page of the site, it can be “/pages/4/pageTitle” or “/category/3/categoryTitle” or “/tag/yii” or any other, for this reason I’m storing the url and I want to know what controller/action coresponds to it, to invoke it from the action of the homepage of my site.

At the end, imagine you have a CMS and you want to choose what page is the homepage of your site, what would you do in that case? What would be the best approach?

Thanks in advance:


Some other idea or tip?

Thank you very much.

Please help me :D

I think CWebApplication.createController() is what you are looking for.