bitmatix
(Bitmatix)
April 9, 2009, 4:43pm
1
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?
qiang
(Qiang Xue)
April 9, 2009, 4:49pm
2
Put the following rule at the end of your rule set.
'<view:\w+>'=>'site/page'
bitmatix
(Bitmatix)
April 9, 2009, 4:58pm
3
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
qiang
(Qiang Xue)
April 9, 2009, 5:13pm
4
Then perhaps you should do this name mapping in your action, if you have a lot of such names to translate.
bitmatix
(Bitmatix)
April 9, 2009, 5:15pm
5
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?
bitmatix
(Bitmatix)
April 14, 2009, 7:18am
6
Any example for the mapping function?
qiang
(Qiang Xue)
April 14, 2009, 12:21pm
7
The mapping can be done using an array (input name=>output name).
bitmatix
(Bitmatix)
April 15, 2009, 9:31am
8
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)
{
switch ($actionID)
{
case 'impressum':
$this->render('pages/imprint');
break;
default:
parent::missingAction($actionID);
break;
}
}
is this right?
WilsonC
(Wil14son)
April 15, 2009, 11:18am
9
How about extending CViewAction in a new class and using it to perform the mapping instead?
qiang
(Qiang Xue)
April 15, 2009, 12:45pm
10
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().
bitmatix
(Bitmatix)
April 15, 2009, 2:24pm
11
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