Crezzur.com Posted March 9, 2016 Share Posted March 9, 2016 hello all, I am having issues with a error which is showing on the "https://validator.prestashop.com/" Error: Variable $this is undefined. Example of error: <p>'. $this->l('Content') .'</p> so i have a module, lets call it "testmodule" if i use the $this->l('Content') inside testmodule.php it gives no error. But when i add a php page for example additional_page.php it says the variable is not defined. Any clues which file i need to include in order to define the variable? using $this = '' at the start of the page doesn't work! Kind regards Jaimy Link to comment Share on other sites More sharing options...
polosat Posted March 10, 2016 Share Posted March 10, 2016 Try this code: $testModule = Module::getInstanceByName('testmodule'); echo $testModule->l('test', 'additional_page'); This is the main idea, so just replace "testmodule" and "additional_page" by relevant values and use $testModule->l() where you need. Link to comment Share on other sites More sharing options...
Crezzur.com Posted March 10, 2016 Author Share Posted March 10, 2016 i am receiving this error Error: Fatal error: Call to a member function l() on a non-object in /home/.../sendmail.php on line 23 [PrestaShop] Fatal error in module file :/home/.../sendmail.php: Call to a member function l() on a non-object Code: $testModule = Module::getInstanceByName('Newsletterbuilderandsender'); echo $testModule->l('test', 'sendmail'); kind regards Jaimy Link to comment Share on other sites More sharing options...
polosat Posted March 10, 2016 Share Posted March 10, 2016 "Newsletterbuilderandsender" should be lowercase there. Link to comment Share on other sites More sharing options...
Crezzur.com Posted March 10, 2016 Author Share Posted March 10, 2016 works perfectly now ! thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now