Guest laptopsdirect.nl Posted October 15, 2006 Share Posted October 15, 2006 If you look at my site http://www.laptopsdirect.nl you'll see it's bi-lingual -> English and Dutch (Nederlands). I am so glad Cubecart has this option through the lang files. Now I placed a couple of banners (top right about shipping) and a specific laptop banner in the middle above latest products. Those are in one language (as I made them). I want to make them in two languages and then I want that the page loads the specific banner image according to chosen language. Now I have seen that you can load different content for different browser versions. I was wondering if there was a way to do this for these banners as well. Quote Link to comment Share on other sites More sharing options...
Guest Brivtech Posted October 15, 2006 Share Posted October 15, 2006 There's a lang variable that's used to select the language when looking for the language file. You could use the same variable to access a different language version of the banners. Quote Link to comment Share on other sites More sharing options...
convict Posted October 15, 2006 Share Posted October 15, 2006 (edited) There is a way. Just add the lang abbreviation to the banner name like banner_en.jpg, banner_nl.jpg. Open index.php SEARCH FOR$body = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/global/index.tpl"); ADD BELOW IT $body->assign("LANG",$lang_folder); Open skins/your-skin-name/styleTemplates/global/index.tpl ADD {LANG} to any banner filename you use like banner_{LANG}.jpg .... <img src="path/to/banner_{LANG}.jpg"> If you would like to have it on checkout pages, do the same but for cart.php, skins/your-skin-name/styleTemplates/global/cart.tpl Edited October 16, 2006 by convict Quote Link to comment Share on other sites More sharing options...
Guest Stephen Plink Posted October 16, 2006 Share Posted October 16, 2006 There is a way. Just add the lang abbreviation to the banner name like banner_en.jpg, banner_nl.jpg. Open index.php SEARCH FORinclude_once("language/".$lang_folder."/lang.inc.php"); ADD BELOW IT $body->assign("LANG",$lang_folder); Open skins/your-skin-name/styleTemplates/global/index.tpl ADD {LANG} to any banner filename you use like banner_{LANG}.jpg .... <img src="path/to/banner_{LANG}.jpg"> If you would like to have it on checkout pages, do the same but for cart.php, skins/your-skin-name/styleTemplates/global/cart.tpl Dude... you ROCK! I am going to give this a shot! Quote Link to comment Share on other sites More sharing options...
Guest Stephen Plink Posted October 16, 2006 Share Posted October 16, 2006 There is a way. Just add the lang abbreviation to the banner name like banner_en.jpg, banner_nl.jpg. Open index.php SEARCH FORinclude_once("language/".$lang_folder."/lang.inc.php"); ADD BELOW IT $body->assign("LANG",$lang_folder); Open skins/your-skin-name/styleTemplates/global/index.tpl ADD {LANG} to any banner filename you use like banner_{LANG}.jpg .... <img src="path/to/banner_{LANG}.jpg"> If you would like to have it on checkout pages, do the same but for cart.php, skins/your-skin-name/styleTemplates/global/cart.tpl Dude... you ROCK! I am going to give this a shot! Adding this line (in my case on line 74): $body->assign("LANG",$lang_folder); results into an error. Is this line of code supposed to show grey all the way, because it does not. Quote Link to comment Share on other sites More sharing options...
convict Posted October 16, 2006 Share Posted October 16, 2006 Well wrong location Add it just after $body = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/global/index.tpl"); My original post has been modified. Quote Link to comment Share on other sites More sharing options...
Guest Stephen Plink Posted October 16, 2006 Share Posted October 16, 2006 No error this time, but no banner either. I did just as you suggested. When I add the line to index.php and I change the img src to bla bla _{LANG} and the actual image _en exists .... I get no banner. Sorry bro. Quote Link to comment Share on other sites More sharing options...
Guest Arild Posted October 16, 2006 Share Posted October 16, 2006 Just a shot in the blind did you add the file extension banner_{LANG}.jpg Your post say nothing about it?? Quote Link to comment Share on other sites More sharing options...
Guest Stephen Plink Posted October 16, 2006 Share Posted October 16, 2006 I'm confused not drunk :rolly: Quote Link to comment Share on other sites More sharing options...
convict Posted October 16, 2006 Share Posted October 16, 2006 Can you post a part of the index.tpl where the target banner code resides? Quote Link to comment Share on other sites More sharing options...
Guest Stephen Plink Posted October 16, 2006 Share Posted October 16, 2006 Sure! Right now I am not using the variable because the site is live. I actually mean to do it for the shipping banner top right, it is referenced in a stylesheet. However, since you told me directly index.tpl I did try it with the following code: <!-- BEGIN: body --><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset={VAL_ISO}" /> <title>{META_TITLE}</title> <meta name="description" content="{META_DESC}" /> <meta name="keywords" content="{META_KEYWORDS}" /> <link href="skins/{VAL_SKIN}/styleSheets/layout.css" rel="stylesheet" type="text/css" /> <link href="skins/{VAL_SKIN}/styleSheets/style.css" rel="stylesheet" type="text/css" /> <script language="javascript" src="js/jslibrary.js" type="text/javascript"></script> </head> <body> <table align="center" border="0" cellspacing="0" cellpadding="0" class="okvir"><tr> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="topHeader"><tr> <td><a href="index.php"><img src="skins/{VAL_SKIN}/styleImages/logo_{LANG}.gif" alt="{META_TITLE}" border="0" align="left" /></a></td> </tr></table> <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr> <td class="subLeft">{SEARCH_FORM}</td> <td class="subRight" align="right">{SESSION}</td> </tr> <tr> But that gave me a red x instead of the logo you see now (top left), which is hard coded without the {LANG}. So somehow it's not picking up the variable and sreplacing the {LANG} in the image name reference. Quote Link to comment Share on other sites More sharing options...
convict Posted October 16, 2006 Share Posted October 16, 2006 Well live site is live site no argue. Please add the folowing code <!-- logo_{LANG}.gif --> just next to the <td><a href="index.php"><img src="skins/{VAL_SKIN}/styleImages/logo.gif" alt="{META_TITLE}" border="0" align="left" /></a></td> Save, upload. The result will be <td><a href="index.php"><img src="skins/{VAL_SKIN}/styleImages/logo.gif" alt="{META_TITLE}" border="0" align="left" /></a></td><!-- logo_{LANG}.gif --> Dont worry, your site will be OK ;-) Need this to see how is the variable. Try to post part of code snippet from index.php where $body->assign("LANG",$lang_folder); resides ... 2 lines above, two below include. Quote Link to comment Share on other sites More sharing options...
Guest Stephen Plink Posted October 17, 2006 Share Posted October 17, 2006 $GLOBALS['adl_alt_docroot']=$GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'].'/webwinkel'; @include_once $GLOBALS['adl_alt_docroot'].'/twatch_include/logger.php'; $body = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/global/index.tpl"); $body->assign("LANG",$lang_folder); if(isset($_GET['searchStr'])){ $body->assign("SEARCHSTR",treatGet($_GET['searchStr'])); } else { $body->assign("SEARCHSTR",""); Quote Link to comment Share on other sites More sharing options...
convict Posted October 17, 2006 Share Posted October 17, 2006 All is well, no issue found. Have a look into home page source code there is: <!-- logo_nl.gif --> if language is Netherland <!-- logo_en.gif --> if language is English You had to make some mistake Just apply the code and upload the right images to the right folder :) Quote Link to comment Share on other sites More sharing options...
Guest Stephen Plink Posted October 17, 2006 Share Posted October 17, 2006 It's working! BEAUTIFUL! see site: Thanks for everything. I owe you. Quote Link to comment Share on other sites More sharing options...
convict Posted October 18, 2006 Share Posted October 18, 2006 It's working! BEAUTIFUL! see site: Thanks for everything. I owe you.You are welcome :whistle: Quote Link to comment Share on other sites More sharing options...
Guest Posted January 19, 2007 Share Posted January 19, 2007 With this topic in mind, can we do the same thing but in ViewProd.tpl or others in the skins/templates/content folder? I tried this but assigning the lang in the corresponding inc.php file didnt seem to work. Any ideas? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.