nimmr
(Pub)
October 26, 2012, 7:27am
1
Hi
I’m having problems with setting up a controller action, to catch all my static pages.
Eg. I want these static pages to hit SiteController, actionStaticcontentpage:
about
contact
user/help
user/purchase/help
In my config, this works
‘about’ => ‘site/staticcontentpage’
But when I try to catch the ones with slashes in them,
‘user/help’ => ‘site/staticcontentpage’
‘user/purchase/help’ => ‘site/staticcontentpage’
Nothing works, and I can’t seem to find any examples of how to make this work.
Can anyone help me?
alirz23
(Ali Raza)
October 26, 2012, 7:52am
2
ivica
(Ivica Nedeljkovic)
October 26, 2012, 7:54am
3
Check this article:
http://www.yiiframework.com/doc/guide/1.1/en/topics.url
'urlManager' => array(
'showScriptName' => true,
'urlFormat' => 'path',
'rules' => array(
'' => 'site/index',
'login'=>array('user/login'),
'logout'=>array('user/logout'),
'registration'=>array('user/registration'),
'recovery'=>array('user/recovery'),
'<view>'=>array('site/page'),
// another possability'<view:(about|impressum)>'=>'site/page',
'contact' => 'site/contact',
),
),
nimmr
(Pub)
October 30, 2012, 7:31am
4
Hey
I got it working with this code:
‘<view:(about|impressum)>’=>‘site/page’,
Which I had tried before. When I saw you wrote it, it gave it another go. And the problem was that I had another "catch-all" rule that triggered before mine. So all I needed was to move mine up above it.
Ivica:
Check this article:
http://www.yiiframework.com/doc/guide/1.1/en/topics.url
'urlManager' => array(
'showScriptName' => true,
'urlFormat' => 'path',
'rules' => array(
'' => 'site/index',
'login'=>array('user/login'),
'logout'=>array('user/logout'),
'registration'=>array('user/registration'),
'recovery'=>array('user/recovery'),
'<view>'=>array('site/page'),
// another possability'<view:(about|impressum)>'=>'site/page',
'contact' => 'site/contact',
),
),