|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Pat07 Smarty Rookie
Joined: 21 Jun 2019 Posts: 6
|
Posted: Thu Jun 27, 2019 4:16 pm Post subject: scope "Smarty root" ? |
|
|
Hi there.
I have a array variable defined in a module and then I call it in another tpl file.
With debug option I can see that array exists and is set correctly, but with Code: | scope = "Smarty root" | ...
So I try to call it in my tpl file but I can't get anything...
I just make a simple test
Code: | {if !$tableau} Empty {else} Ok {/if} |
It is always "Empty"... I didn't call teh variable the right way?
Thanks! |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Jun 28, 2019 10:16 am Post subject: |
|
|
Can you please fork this repo https://github.com/AnrDaemon/test-001, create a branch named "forum-27802" and reproduce your issue in there? |
|
Back to top |
|
Pat07 Smarty Rookie
Joined: 21 Jun 2019 Posts: 6
|
Posted: Fri Jun 28, 2019 12:36 pm Post subject: |
|
|
Thanks @AnrDaemon for your reply.
First, I never really used github (I knwo it sounds weird...) so I am a bit lost.
Then, my problem came from PRestashop file, themes and modules, so very difficult to reproduce my issue . |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Jun 28, 2019 2:24 pm Post subject: |
|
|
Then can you explain what "module" is supposed to mean?
Can you insert "{debug}" into some top-level template and see what variables are actually loaded into Smarty? |
|
Back to top |
|
Pat07 Smarty Rookie
Joined: 21 Jun 2019 Posts: 6
|
Posted: Fri Jun 28, 2019 3:11 pm Post subject: |
|
|
Thanks.
I inserted {debug} in my tpl file and thanks to that I could see my array has that scope
Code: | scope = "Smarty root" |
It is the only variable with such scope.
For exemple $products has the right scope and I can use it.
In the module the variable is defined that way
Code: | function hookHome($params)
{
global $smarty;
$products = $category->getProducts(intval($params['cookie']->id_lang), 1, ($nb ? $nb : 10));
$productsMP3Info = array();
...} |
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|