forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Themes/Skins/Templates => Topic started by: coopersita on August 08, 2004, 04:42:12 am

Title: Text home link tied to language
Post by: coopersita on August 08, 2004, 04:42:12 am
Hi, I'm new to Coppermine. I was wondering if there is a way to add custom links that will also change language along with the standard menu items?

I was thinking of at least adding a function that changes those links (home, About us, Contact) between the two most common languages I expect users to use (Spanish, and English also as default for all other languages), but I'm not sure in which variable is the language chosen by the user stored...

Any ideas on how to do it? I figured it would be simple (a simple if-else structure)...

Any help will be welcomed.
Title: Re: Text home link tied to language
Post by: Joachim Müller on August 08, 2004, 11:11:22 am
coppermine uses language files you are encouraged to modify as needed. If you need a "home" link in the classic theme for example, you edit themes/classic/theme.php, find
Code: [Select]
// HTML template for main menu
$template_main_menu = <<<EOT
                <span class="topmenu">
and add after it
Code: [Select]
                        <a href="{HOME_LINK_TGT}" title="{HOME_LINK_TITLE}">{HOME_LINK_LNK}</a> ::Then you find
Code: [Select]
    $param = array('{ALB_LIST_TGT}' => "index.php$cat_l",
        '{ALB_LIST_TITLE}' => $lang_main_menu['alb_list_title'],
        '{ALB_LIST_LNK}' => $lang_main_menu['alb_list_lnk'],
and add after it
Code: [Select]
        '{HOME_LINK_TGT}' => "index.php",
        '{HOME_LINK_TITLE}' => $lang_main_menu['home_link_title'],
        '{HOME_LINK_LNK}' => $lang_main_menu['home_link_lnk'],
Next, you will have to modify all language files you plan to use. Edit lang/yourlanguage.php, e.g. lang/english.php, find
Code: [Select]
$lang_main_menu = array(and add after it (in a new line)
Code: [Select]
  'home_link_title' => 'Go to the gallery start page',
  'home_link_lnk' => 'Gallery home',

Save the whole enchilada, upload the modified files to your webserver and test it.

GauGau
Title: Re: Text home link tied to language
Post by: coopersita on August 08, 2004, 05:07:02 pm
Thanks, I'll give it a try. I wish there were a manual with a llist of all template tags and such...
Title: Re: Text home link tied to language
Post by: coopersita on August 08, 2004, 06:45:35 pm
It worked like a charm.

I only wish there was a default language folder, so that I don't have to change all language files (in languages other than the ones I changed it doesn't show any link at all...). I think I'll just eras all other languages but the esencial ones for this site.

Thanks again
Title: Re: Text home link tied to language
Post by: Joachim Müller on August 09, 2004, 12:04:06 am
you're encouraged to leave only those language files on your server you actually want to use. Remove all unused languages.

In cpg1.4, there will be a language fallback routine - if a translation doesn't exist in a special language, coppermine will default back to english and show the untranslated bit in english.

GauGau