If this is your first visit, check our documentation. To post, register or login.
Forums / Addon Language Packs / define a constant text

define a constant text

Started by janine on 16 Nov 2011, 11:01 AM · Views: 3,278

Results 1 to 6 of 6
16 Nov 2011, 11:01 AM
#1
janine avatar

janine

New Zenner

Join Date:
Nov 2011
Posts:
2
Plugin Contributions:
0

define a constant text

hello,
i hope i place this question in the right area.
I have a multilanguage website Dutch/English and i use overides.
I want to place a constant text next to my product image.
But i cant seem to figure out how to get the dutch text in the dutch area and the english text in the english area.
Now i have to place the text every time in the product discription but it costs a lot of time to put it in the right place.
Can someone tell me step by step how to set a text permantly in the template in a way that if a visit the dutch version i see the dutch text and if i visit the english version i see the english text.

Thank you very much,
janine

http://crossstitchplace.nl

18 Nov 2011, 5:35 PM
#2
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: define a constant text

You need to make a define in a language file. Steps to do that :

  1. Make a new file in includes/languages/english/extra-definitions and call it something like my_definitions.php . The file should look something like :
<?php

define('MY_NEW_DEFINE', 'Text to appear on page in English');
  1. Make a new file in includes/languages/dutch/extra-definitions and call it the same thing . The file should look something like :
<?php

define('MY_NEW_DEFINE', 'Text to appear on page in Dutch');

So far you have defined a constant called 'MY_NEW_DEFINE' that will be one thing in english and will be another thing in dutch.

  1. Now you need to used that in one of the templates. If you are trying to put it on the product_info page you will probably want to edit includes/templates/YOURTEMPLATE/templates/tpl_product_info_display.php. Depends a bit where you actually want to out the text. In that file you need to add the following code:
<?php
echo MY_NEW_DEFINE;
?>

That's it .

Actually there are a few subtleties ( like making override versions of the first two files ) but the above should work.

Nick
iszent.com

9 Dec 2011, 3:28 AM
#3
haizi72g3t avatar

haizi72g3t

New Zenner

Join Date:
Nov 2011
Posts:
39
Plugin Contributions:
0

Re: define a constant text

or just copy english folder in the admin panel and reupload it as Dutch and from there when you add products you can add dutch text and english txt

9 Dec 2011, 11:01 AM
#4
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: define a constant text

Well, I think he was asking how to put some text that wasn't already defined in the language files.

But if it is just an existing language define then what you say is true. Or of course you could just use one of the existing language packs......

Nick
iszent.com

15 Dec 2011, 1:57 PM
#5
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: define a constant text

yes, but the question was how to add a define that wasn't already included in the existing defines.

Nick
iszent.com