问题描述:

how to write url address with parameter like this

www.example.com/param1/var1/param2/var2

and next get it with :

$param1 = Mage::app()->getRequest()->getParam('param1');

$param2 = Mage::app()->getRequest()->getParam('param2');

网友答案:

The default router expects that the first 3 parts in the url to be module, controller, action and then the rest of the parameters are treated as GET parameters.
You can generates such an url like this:

Mage::getUrl('module/controller/action', array('param1'=>'var1', 'param2'=>'var2'))
网友答案:

check here for full deails on this :

you need to do something like this.

http://www.magentocommerce.com/wiki/5_-_modules_and_development/reference/geturl_function_parameters

Mage::getUrl('cms/page/view', array('id' => 1));
// http://www.example.com/cms/page/view/id/1

Also your code to get these values from url is correct.

相关阅读:
Top