Jump to content

Edit History

arvistar

arvistar

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

arvistar

arvistar

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';
		$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

×
×
  • Create New...