Jump to content

Obtain a module link


piribipipi
 Share

Recommended Posts

Hi, i created a module, and im trying to obtain a link to a php inside the module.

Im using this:

$url= $this->context->link->getModuleLink('mymodule', 'validation.php', array('pps' => 1), Configuration::get('PS_SSL_ENABLED'));

but link generated is:

http:/storeX.com/module/mymodule/validation.php

 

and its not correct, it should be:

http://storeX.com/modules/mymodule/validation.php (including a "s" in module)

 

whats happening? someone can help me??

 

thanks!!

Edited by piribipipi (see edit history)

Share this post


Link to post
Share on other sites

Hello,

You have no problem the redirection is good.
The rewrite link of the modules controllers use the keyword "module" as you can see in the file class/Dispatcher.php

'module' => array(
			'controller' =>	null,
			'rule' =>		'module/{module}{/:controller}',
			'keywords' => array(
				'module' =>		array('regexp' => '[_a-zA-Z0-9_-]+', 'param' => 'module'),
				'controller' =>		array('regexp' => '[_a-zA-Z0-9_-]+', 'param' => 'controller'),
			),
			'params' => array(
				'fc' => 'module',
			),
		),

Share this post


Link to post
Share on other sites

this is proper url.

method you use creates link to controllers, not to files!

validation.php should be replaced with module front controller

only then module will be "valid" and properly constructed

 

$url= $this->context->link->getModuleLink('mymodule', 'It should be a module front controller not a File', array('pps' => 1), Configuration::get('PS_SSL_ENABLED'));

Share this post


Link to post
Share on other sites

  • 4 years 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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More