Jump to content

how can i go to external url link from smarty tpl file. presta 1.7


Recommended Posts

Hello everyone. 

My prestashop is 1.7.8.7

In my module tpl file I need to navigate to a sidelink (external url). :

<p><a href="{$mylink}" />external</a></p>

where $mylink = 'https://other_site.com'

but the result is: 'https://my_prestashop_site.com/admin/www://other_site.com'

Please advise how to solve the problem. What am I doing wrong? Where can I read about it? Thanks for the any answers.

Edited by arvistar (see edit history)
Link to comment
Share on other sites

Here is how I pass variables from the controller (php) to the smarty template (tpl) in MyModule:

Class MyModuleController extends AdminController {
	public function __construct()
    {
        parent::__construct();
        $this->bootstrap = true;
        $this->id_lang = $this->context->language->id;
        $this->default_form_language = $this->context->language->id;
    }
	 public function initContent()
    {
        parent::initContent();
		$link = 'https://other_site.com'; // The Right Solution
		// $link = 'www.other_site.com'; // Wrong decision
		$this->context->smarty->assign('mylink', $link);	
	}

}

This is how I get the variables in the smarty template :

<div>
  <p><a href="{$mylink}">External</a></p>
</div>

I will be very grateful for your help. Thank you

Edited by arvistar (see edit history)
Link to comment
Share on other sites

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...