Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

scope "Smarty root" ?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Pat07
Smarty Rookie


Joined: 21 Jun 2019
Posts: 6

PostPosted: Thu Jun 27, 2019 4:16 pm    Post subject: scope "Smarty root" ? Reply with quote

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! Question
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Jun 28, 2019 10:16 am    Post subject: Reply with quote

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
View user's profile Send private message
Pat07
Smarty Rookie


Joined: 21 Jun 2019
Posts: 6

PostPosted: Fri Jun 28, 2019 12:36 pm    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Jun 28, 2019 2:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
Pat07
Smarty Rookie


Joined: 21 Jun 2019
Posts: 6

PostPosted: Fri Jun 28, 2019 3:11 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP