Jump to content

Banner with language option


Guest laptopsdirect.nl

Recommended Posts

Guest laptopsdirect.nl

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.

Link to comment
Share on other sites

Guest Brivtech

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.

Link to comment
Share on other sites

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 by convict
Link to comment
Share on other sites

Guest Stephen Plink

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

include_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!

Link to comment
Share on other sites

Guest Stephen Plink

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

include_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.

Link to comment
Share on other sites

Guest Stephen Plink

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.

Link to comment
Share on other sites

Guest Stephen Plink

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Guest Stephen Plink

	$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","");

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

  • 3 months later...

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?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...