I want to control a small snippet of text in the my header and footer depending the language chosen.
Can anyone give me a code snippet that I can stick into the header and footer files to check for this?
I want to control a small snippet of text in the my header and footer depending the language chosen.
Can anyone give me a code snippet that I can stick into the header and footer files to check for this?
and then define MY_TEXT in the language file for each language. E.g.echo MY_TEXT
define('MY_TEXT','Hello'); in english.php
define('MY_TEXT','Bonjour'); in french.php
define('MY_TEXT','Hola'); in spanish.php
Kuroi Web Design and Development | Twitter
(Questions answered in the forum only - so that any forum member can benefit - not by personal message)
Define the text as the value of a constant in a language file, and it will be swapped automatically when you switch languages.
You should have a separate version of all language files for each language.
...Like Kuroi describes above...
Zen Cart Magic
![]()
Kuroi Web Design and Development | Twitter
(Questions answered in the forum only - so that any forum member can benefit - not by personal message)
I've been attempting to put the information in this thread to use but have run into a snag - I can't really get my head around the logic.
I would like to have a home link in the header for each of the two site languages, each leading to their respective home locations. I've added this to tpl_header.php:
and defined it in italian.php. On the Italian side it works as intended. However, on the English side, in the header bar, you see:<li><?php echo '<a href="' . zen_href_link(FILENAME_HOME_IT, '', 'SSL') . '">' . BOX_INFORMATION_HOME_IT . '</a>'; ?></li>
Since the tpl_header.php file is not located in a language file, it makes sense that it would be visible, but I can't quite immagine how to properly resolve it. Can I just add a language file within my includes/templates/my_template/? Somehow that doesn't seem quite kosher...BOX_INFORMATION_HOME_IT
Hmmm... OK, after re-reading what I posted it occured to me that I had not defined the English side of things. So, in english.php:
Leaving it blank seemed to work.// Italian language home link
define('BOX_INFORMATION_HOME_IT', '');
Now, how can I properly direct this link to the Italian language home page?
Usually I would do something like:<li><?php echo '<a href="' . zen_href_link(FILENAME_HOME_IT, '', 'SSL') . '">' . BOX_INFORMATION_HOME_IT . '</a>'; ?></li>
but then the file names are not being utilized and so wouldn't be recognized by the language files, right?<li class="submenu"><a href="http://www.beadedlilydesigns.com/?language=it">Home</a>Ow - My head!!
If you are wanting to (say) go to the Italian homepage from an English page, you would also (first) want to switch the language setting. When that happens, the home page will show in Italian, and the rest of the site will display in Italian until you switch back to English.
Or are you not wanting to switch languages in the session? That sounds tricky, forcing the page to display in a language other than the one set. You might be able to force it by adding to the url "&language=italian" in whatever form that should take... maybe?? Would that reset the session value?? Would it be read by the files using $_SESSION['language'] ?
Yes. my head hurts too...
The page is not a single file, and the language files are called by the destination files, not in the url. I think you will need to make the session language switch before the homepage link happens, or maybe you can do them simultaneously. Is that something that javascript can do that PHP can't?
If I remember correctly, zen stores the language you selects in session. So the language param appears in the url only at the first time you select the language.
So if you visit a page for too long and the session expires, then you are switched back to the default languages.
Most seo modules (excluding ultimate seo url, I believe) addresses this problem by always inserting the language code in the links.
I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me