Jump to content

how to solve the issue use of globals is forbidden


Recommended Posts

 

Hi,

 

I am doing a small module in prestashop. In that module I have used 

 


global $cookie, $smarty;

for both smarty and cookie as global.

It is working fine with prestashop 1.5.6.1. Now when I tried to validate the module in 


then after all the process of validation it showed me an error like 



Use of globals is forbidden


Now If I am using global value smarty as 


$this->context->cookie = $cookie


and for smarty I am using


$this->smarty


then it is showing as undefined variable for both smarty and cookie.

 

So to make that clear how this has been done in other modules I have gone through prestashop own module blocklayered and I have seen in that module both 



global $cookie;


and  


global $smarty;


has been used. I have checked this with prestashop 1.5.6.1.  and new 1.6.0.3 version. So can someone kindly tell me what's the wrong here. The same code is woring in another module and that code is in my custom module showing validation error? Why? Any help and suggestions will be really appreciable. Thanks

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...