Author Topic: How to sent manual variable to loadTemplate  (Read 2807 times)

alexxsav

  • Beginner
  • *
  • Posts: 23
How to sent manual variable to loadTemplate
« on: June 04, 2014, 14:00:09 pm »
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

  • 3rd party VirtueMart Developer
  • Beginner
  • *
  • Posts: 39
    • Software Solutions byPV
Re: How to sent manual variable to loadTemplate
« Reply #1 on: June 06, 2014, 11:28:35 am »
Hi,

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

Regards,
Pavel

alexxsav

  • Beginner
  • *
  • Posts: 23
Re: How to sent manual variable to loadTemplate
« Reply #2 on: June 10, 2014, 10:36:22 am »
Thanks^ but can you explain what you mean?

byPV

  • 3rd party VirtueMart Developer
  • Beginner
  • *
  • Posts: 39
    • Software Solutions byPV
Re: How to sent manual variable to loadTemplate
« Reply #3 on: June 10, 2014, 11:40:59 am »
Hi,

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

Code: [Select]
...
...
$this->your_variable = 'some value';
...
$this->loadTemplate('customtemplate');
...
...

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

Code: [Select]
...
...
echo $this->your_variable;
...
...

Regards,
Pavel