coppermine-gallery.com/forum

Support => Older/other versions => cpg1.3.x Support => Topic started by: PatHibulaire on August 24, 2005, 11:32:34 PM

Title: smilies.inc.php and lang files
Post by: PatHibulaire on August 24, 2005, 11:32:34 PM
Hi,

I'm new here and I use Coppermine since a little time and I would like to congratulate developpers for the job they did (and they do :)).

I have a question about file "smilies.inc.php" :

I added smilies to Coppermine and, in this file, I added too a link which allows to hide/show the smilies list. However I would like to change the text of this link according to smilies being displayed or not (if smilies are displayed, link is "Hide smileys" and if smilies are hidden, link is "Show smilies"). I can put this text directly in "smilies.inc.php" and all works fine, but I would like to use the language files.

So I set 2 vars in lang files : $lang_smilies_inc_php['smiliesShow'] = "Show Smilies" and $lang_smilies_inc_php['smiliesHide'] = "Hide smilies".

I try to use these 2 vars in "smilies.inc.php" (in function "generate_smilies"), so I set "$lang_smilies_inc_php" to global in "generate_smilies" but the 2 vars stay blank when I call "displayimage.php".

So my question is how can I use a var defined in a lang file in file "smilies.inc.php" ?

PS : I have shown a thread which said to add define('SMILIES_PHP', true); in "displayimage.php", so I uncommented the line but it still doesn't work.

Thanks for your help
Title: Re: smilies.inc.php and lang files
Post by: Nibbler on August 24, 2005, 11:39:40 PM
Where in the lang file did you add the new variables ? Try adding them into the existing array.
Title: Re: smilies.inc.php and lang files
Post by: PatHibulaire on August 24, 2005, 11:56:39 PM
It's what I did, here is part of the code :


if (defined('SMILIES_PHP')) $lang_smilies_inc_php = array(
'Interrogation' => 'Interrogation',
'Heart' => 'Heartr',
...
'smiliesShow' => 'Show smilies',
'smiliesHide' => 'Hideles smilies',
);


and in "smilies.inc.php" :


function generate_smilies($form = 'post', $field = 'message')
{
global $lang_smilies_inc_php;
...
$html .= '<a href="#" onClick="'.$jsFunc.'" id="smiliesShowHide'.$smiliesListId.'">'.$lang_smilies_inc_php["smiliesShow"].'</a>';
...
Title: Re: smilies.inc.php and lang files
Post by: Nibbler on August 25, 2005, 12:11:24 AM
I just applied the changes you describe to my test install and it worked fine. Make sure you are editing the right lang file for the lang you actually use.
Title: Re: smilies.inc.php and lang files
Post by: PatHibulaire on August 25, 2005, 08:47:03 AM
Well I don't understand, I reinstalled Coppermine in another folder and $lang_smilies_inc_php is blank.
Title: Re: smilies.inc.php and lang files
Post by: Joachim Müller on August 26, 2005, 09:21:00 AM
When you access an include file directly in your browser, that's expected behaviour. What's the actual problem?
Title: Re: smilies.inc.php and lang files
Post by: PatHibulaire on August 26, 2005, 02:49:00 PM
I deleted line which test if SMILIES_PHP is defined in lang file and all works fine now.
Array is so available everywhere.