Jump to content

Module Route p1.6


flobrflo

Recommended Posts

Hi,

i would like to use ModuleRoute for my module in presta 1.6.

 

i try to use :

 

In mymodule.php

public static $ModuleRoutes = array(
		'route-name' => array(
			'controller' =>  null,
			'rule' =>        '{module}/{/:controller}',
			'keywords' => array(
				'module'        =>   array('regexp' => 'modulename', 'param' => 'module'),
				'controller'    =>   array('regexp' => 'controllerfile', 'param' => 'controller')
			),
			'params' => array(
				'fc' => 'module'
			)
		)
	);

and the hook :

public function hookModuleRoutes()
{
	return self::$ModuleRoutes;
}

In my controller file:

public function initContent()
{
	parent::initContent();

	$this->context->smarty->assign('message', $this->message);
	$this->setTemplate('view_execution.tpl');
}

but when i try to access to:

http://mydomain.com/modulename/controllerfile  , got a 404 and can't access to my route.

 

Help =D

Link to comment
Share on other sites

add :

'params' => array(
	'module' => 'module-name',
	'fc' => 'module'
)

but same error.

 

i just need 1 url, so i writte :

'route-name' => array(
	'controller' =>  null,
	'rule' =>  'module-name/controller-name',
)

and that's work...

don't understand why with params i get errors..

Link to comment
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...