News:

Support the VirtueMart project and become a member

Main Menu

How to sent manual variable to loadTemplate

Started by alexxsav, June 04, 2014, 14:00:09 PM

Previous topic - Next topic

alexxsav

Hello.

I have some customization in product.tpl. I add manual variable and want to use it in other template file. I input this template file like: $this->loadTemplate('customtemplate');
But i cant get access to this variable, and have to write creation again - its not useful.
Any advise?

byPV

Hi,

if you assign the variable into $this->{variable} then you can access to this value from another templates.

Regards,
Pavel

alexxsav

Thanks^ but can you explain what you mean?

byPV

Hi,

If I understand properly, this code in a template will help you:


...
...
$this->your_variable = 'some value';
...
$this->loadTemplate('customtemplate');
...
...


In the customtemplate you can access to the variable by way:


...
...
echo $this->your_variable;
...
...


Regards,
Pavel