Snade Posted February 28, 2011 Share Posted February 28, 2011 Hello everyone,I need to add more languages to a client website. Everything is as usual for the rest of the site, but I got problems with the front page.The site uses addstuffhomepage module for the frontpage content, and there are 6 images which have text on them. In order to change their language, I need to change the images. I found instructions for changing the logo refering to the language using {$lang_iso} tag in the img src (in the .tpl fail).img src="{$img_ps_dir}logo_{$lang_iso}.jpg"- http://www.prestashop.com/forums/viewthread/46690/#219561Since the content for the front page is stored into .html file called, static_link.html, I cant use the method above directly on the images.So, basically I want to make the same thing, but instead changing every img src, I want to change the html file that is called by the addstuffhomepage module. I want to have static_link_en.html, static_link_fr.html and so on, and depending what language is chosen, the php of the module to call the required file.At the moment, the filename of the .html file(static_link.html) has to be filled in the module settings at the backoffice.My idea is to edit the php file, and instead of backoffice form input, the .html filename to be chosen depending on the language selected.Here is the line from the module php file, which gets the data from the backoffice settings form. <input type="text" name="mystuff" style="width: 300px;" value="'.Tools::getValue('mystuff', Configuration::get($this->name.'_filepath')).'" /> '.$this->l('Example (default):').' mystuff.html I dont understand much php, I'm mainly a designer, but I found out that the function Tools::getValue() get the field content, so the variable that I need to change is - "mystuff" (actually, am I right ?!)I need "mystuff" to be either static_link_fr.html or static_link_en.html.How can I do that in php ? How can I make the php to call static_link{$lang_iso}.html (or someting like that in php...), so I can make separate html fail for each language.Thank you very much for your helpBest regards, Alexader Link to comment Share on other sites More sharing options...
ezeta Posted March 27, 2011 Share Posted March 27, 2011 HiI have the some issue:I tried the following in addstuffhomepage.php function hookRightColumn($params) { global $smarty; $srcFile=Configuration::get($this->name.'_filepath'); if ($srcFile=='') { $srcFile="mystuff.html"; } // Add this code $id_language = $params['cookie']->id_lang; $lang_iso = Language::getIsoById($id_language); $path_parts = pathinfo($srcFile); $srcFile = $path_parts['filename']."_".$lang_iso.".".$path_parts['extension']; Hope this help.------------------------ Link to comment Share on other sites More sharing options...
Recommended Posts