Display static pages

If followed the instrustions in this article:

http://www.yiiframew…oc/cookbook/22/

and created a page "imprint", which url is:

http://www.domain.co…ge/view/imprint

but what I want to get is:

http://www.domain.com/imprint

There are a lot of more static pages, so the route has to be variable (I think).

Can anybody tell me what the required route has to look like?

Put the following rule at the end of your rule set.

'<view:\w+>'=>'site/page'

thank you qiang. I forgot to mention, that the page (file) is called "imprint.php", but in german I have to name it "impressum" in the url.

how can I handle this?

EDIT:

what I want to do is, to get this:

http://www.domain.co…ge/view/imprint

into this:

http://www.domain.com/impressum

Then perhaps you should do this name mapping in your action, if you have a lot of such names to translate.

Quote

Then perhaps you should do this name mapping in your action, if you have a lot of such names to translate.

Ok, could you please paste an example, in which action to handle this?

Any example for the mapping function?

The mapping can be done using an array (input name=>output name).

Quote

The mapping can be done using an array (input name=>output name).

I didn't get it in the "actions" function to work, so I used the "missingAction" function in "SiteController.php":

public function missingAction($actionID)


{


&nbsp; switch ($actionID)


&nbsp; {





&nbsp; &nbsp; case &#039;impressum&#039;:


&nbsp; &nbsp; &nbsp; $this-&gt;render(&#039;pages/imprint&#039;);


&nbsp; &nbsp; break;





&nbsp; &nbsp; default:


&nbsp; &nbsp; &nbsp; parent::missingAction($actionID);


&nbsp; &nbsp; break;


&nbsp; }


}

is this right?

How about extending CViewAction in a new class and using it to perform the mapping instead?

That's even better. You could declare the page name mapping as a property of the class. You can then configure this property in your controller file when declaring the action in actions().

Ok guys, that sounds good. It would be very nice, if you can give me an example, because I think, i stuck on this problem :frowning: