Jump to content

Creating custom modules and adding translations for them


Mitchell Ransom

Recommended Posts

Hi,
I've created a few custom modules using some very simple code. I am using multiple languages on my website and want to add translations to my modules however whenever I use the following commands in the code for my modules my front office goes blank after reaching the custom module, that is to say everything on the page loads as normal up until the custom module and then the page load stops leaving only blank areas after the custom module.

Code I am using for the translations:

{l s='Welcome to Neon Flame' mod='homechanger'}



I place this code into my homechanger.php file inside the class:

public function hookHome()
   {
       return '{l s='Welcome to Neon Flame' mod='homechanger'}';
   }



I am not using a .tpl file or back office configuration, I'm simply using the homechanger.php file to directly modify the html output. If you have any ideas of where I am going wrong or if you know of any relevant documentation on creating prestashop modules with translations then I would be very greatful if you could reply here.

Kind regards, Mitchell Ransom

Link to comment
Share on other sites

  • 2 weeks later...

Mitchell,

You need to process smarty tags using smarty, so in order for your code to work you need to place your code in a .tpl file and then render it via smarty. In saying that I wouldn't necessarily expect the above to cause it to crash. Have you configured php to write errors to a log file on your server? You should seriously consider doing so if not, as it will allow you to perform a post-mortem on the page load and see what errors php is throwing.

Paul

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