View Single Post
  #10  
Old 12-20-2012, 11:17 AM
 
tartaglia tartaglia is offline
 

X-Adept
  
Join Date: May 2006
Location: Dallas, TX
Posts: 575
 

Default Re: Dynamic Image Directory Reference from within Langauge Variable

So here's the result...

Sorry Steve your suggestion...
Code:
<a href="home.php"><img src="{$AltImagesDir}/custom/mypicture.jpg" /></a>
doesn't work, but thanks.

What does work is...
Code:
<a href="home.php"><img src="{{AltImagesDir}}/custom/mypicture.jpg" /></a>

if you call it like this from the tpl file...
Code:
{$lng.languagevariablename|substitute:"AltImagesDir":$AltImagesDir}

I believe this is because the language variable itself can't pass through the real value of the smarty variable. Therefore they use the {{ }} to identify a value that can be called out by the substitute function and in the substitute function they replace the AltImagesDir with the smarty variable {$AltImagesDir} which of course the tpl file know.

There ya go, it works now. All that to avoid hardcoding the path in the language variable, not sure it was worth it but a good learning exercise. Feel free to give a more proper explanation of why it works if you want. I am not a developer.
__________________
David Coggan
Carolyn Nussbaum Music Company
X-Cart v4.5.4 Gold +
LiteCommerce v2.2.41 (previous 6 years)
Reply With Quote