arvistar Posted December 8, 2022 Share Posted December 8, 2022 (edited) 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 December 11, 2022 by arvistar (see edit history) Link to comment Share on other sites More sharing options...
JBW Posted December 10, 2022 Share Posted December 10, 2022 How do you fill $mylink? Link to comment Share on other sites More sharing options...
arvistar Posted December 10, 2022 Author Share Posted December 10, 2022 I fill it from controler.php file. Link to comment Share on other sites More sharing options...
Mediacom87 Posted December 10, 2022 Share Posted December 10, 2022 Il y a 6 heures, arvistar a dit : I fill it from controler.php file. How exactly ? Link to comment Share on other sites More sharing options...
arvistar Posted December 11, 2022 Author Share Posted December 11, 2022 (edited) 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 December 11, 2022 by arvistar (see edit history) Link to comment Share on other sites More sharing options...
arvistar Posted December 11, 2022 Author Share Posted December 11, 2022 I found my mistake. The problem was that I was giving the variable the value "www.other_site.com". The correct solution is: "https://other_site.com". Guys, I'm very sorry for your lost time. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now