Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Image directory depending on language Rate Topic   - - - - -

  • d2event
  • Junior Member
  • Members
  • Join Date: 30-Jan 08
  • 13 posts

Posted 24 January 2009 - 07:36 PM #1

How to set image directory depending on language?

For example I would like to add 3 images in main.tpl (I have english and polish images):
{foreach from=$all_languages item=language}
<a href="index.php?target=pages&page_id=1"><img border="0" alt="" src="images/{$language.lang_code}/1.jpg" /></a><br /><br />
<a href="index.php?target=pages&page_id=2"><img border="0" alt="" src="images/{$language.lang_code}/2.jpg" /></a><br /><br />
<a href="index.php?target=pages&page_id=3"><img border="0" alt="" src="images/{$language.lang_code}/3.jpg" /></a>

HTML example:
<a href="index.php?target=pages&page_id=1"><img border="0" alt="" src="images/EN/1.jpg" /></a><br /><br />
<a href="index.php?target=pages&page_id=2"><img border="0" alt="" src="images/EN/2.jpg" /></a><br /><br />
<a href="index.php?target=pages&page_id=3"><img border="0" alt="" src="images/EN/3.jpg" /></a>
<a href="index.php?target=pages&page_id=1"><img border="0" alt="" src="images/PL/1.jpg" /></a><br /><br />
<a href="index.php?target=pages&page_id=2"><img border="0" alt="" src="images/PL/2.jpg" /></a><br /><br />
<a href="index.php?target=pages&page_id=3"><img border="0" alt="" src="images/PL/3.jpg" /></a>

I would like to have only one set of images so when customer click polish language he has polish images, when he select english he has english etc. Right now he see all (eng and pol) images.

I know I shouldn't use "{foreach ]" but what?

  • mdekok3000
  • Senior Member
  • Members
  • Join Date: 06-Feb 08
  • 883 posts

Posted 24 January 2009 - 07:44 PM #2

Try this instead:

<a href="index.php?target=pages&page_id=1"><img border="0" alt="" src="images/{$cart_language}/1.jpg" /></a><br /><br />
<a href="index.php?target=pages&page_id=2"><img border="0" alt="" src="images/{$cart_language}/2.jpg" /></a><br /><br />
<a href="index.php?target=pages&page_id=3"><img border="0" alt="" src="images/{$cart_language}/3.jpg" /></a>


  • d2event
  • Junior Member
  • Members
  • Join Date: 30-Jan 08
  • 13 posts

Posted 24 January 2009 - 07:56 PM #3

Thank you its working :) Very simple :D