Jump to content

[solved] How to add a value to smarty array?


xezus

Recommended Posts

Hi,

I am having a problem with adding values to my new array which I created in my new module.

 

 

public function install()
{
return (parent::install()
......
&& Configuration::updateValue('my_array', array())
.....
}

 

 

Please could somebody tell me how could I add a new value to this array?

I would be glad for any answer.

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

I am sorry I am new in prestashop but I would like to create a array in my modul and dynamically add values into it and then use this array in my theme like normal smarty array (like $css_files for example)

 

And from what I understand until know is that I have to create php array like this and then use this

 

 

public function hookDisplayHeader($params) {

 

$this->context->smarty->assign(

array( ...'name' => my created array..... )

);

}

 

 

to enable me to use the array in my theme.

Link to comment
Share on other sites

  • 11 months later...

if in php you use code like:

$smarty->assign(array('variable1'=>'value1', 'variable2' => 'value2'));

to access these variables in tpl file use:

 

{$variable1} - it will display "value1"

{$variable2} - it will display "value2"

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