Modules url rules problem

Hi…

I left CodeIgniter as a framework for our project to instead use Yii as i find it much cleaner and built in support for modules that we need.

But, i have one module now called "appStore" (internally project) but i can only get the default page.

As i have search google and this forum it seems like there is many different answers, but non of them works for me.

Since i have just been thrown into Yii and learn by doing things are a little tricky for me.

So i tried a bunch of rules, but non of them worked. I had one that worked for a minute, but then the main controllers (not module) stopt working.

So i tried to write one on my own just to show how i am thinking.


'<module:\w+/<controller:\w+/<action:\w+>/<id:\d+>'=> '<module>/<controller>/<action>',

But this is not valid ( i know nothing of regex). How can i access my module controllers without making a lot of configuration fuzz?

Thankyou and Go Yii…

System: Windows Server R2 2008 - IIS 7.5 M.rewrite, MSSql 2012 Enterprise - Yii 1.1.10 - PHP 5.3

Regards

Audun Frøysaa

Hi Audun, welcome to Yii!

Personally I think it’s better not to use ‘SEO friendly URL’ in the earlier stages of development, especially when it’s the first attempt in Yii.

It tends to lead to confusion about the creation of urls. I mean, you tend to forget ‘createUrl()’ function and hardcode the links in path format, and make the codes less maintainable.

We should write every links using ‘createUrl()’ so that the app runs fine with ‘get’ format of url before adopting ‘path’ format. You can apply ‘path’ format at the very last stage.




'urlManager'=>array(

	'urlFormat'=>'path',

	'showScriptName' => false,

	'rules'=>array(

		'<module:\w+><controller:\w+>/<id:\d+>'=>'<module><controller>/view',

		'<module:\w+><controller:\w+>/<action:\w+>/<id:\d+>'=>'<module><controller>/<action>',

		'<module:\w+><controller:\w+>/<action:\w+>'=>'<module><controller>/<action>',

		'<controller:\w+>/<id:\d+>'=>'<controller>/view',

		'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

		'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

	),

),



I can’t assure you the code above will fit your project. It depends.

But, well, if your project is not very much complicated yet, I hope it should work.

If it doesn’t, comment them out for the moment to return to ‘get’ format, and read the guide carefully and make your own rules.

http://www.yiiframework.com/doc/guide/1.1/en/topics.url

It’s much more organized and simple than in CI, and I like it. :)

Yea, you are absolutely correct softark…

I just need to make sure everything is working as expected as we have a marketing team setting up how the url’s should look.

We want to access module’s controllers in the same way Yii works by default like

<domain>.<tld>/<module>/<controller>/<action> (This is how Codeigniter HMVC worked)

For some reason i can’t get that to work at all, but i know thats just a learning curve.

Yea, i really like Yii but i just wish i would have time to learn if from the bottom up instead of learn by doing like now…

I ordered the Yii Framework book so hopefully that will help a great deal…

Any help appreciated as i just need a proof of concept that the module -> Controller url’s are working as Marketing wants.

Thank you guys so much!

Regards

Audun