Multilingual footers and other common content

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Der Rudi
Forum Members
Forum Members
Posts: 56
Joined: Wed May 17, 2006 7:42 pm

Multilingual footers and other common content

Post by Der Rudi »

Please also see my last post in this topic!

Multilingual footers and other common content

when using the multilingual hack by katon (good work btw), I needed a way to select footers based on the language selected. Since this was not included I decided to have a go at this myself. This is what I got to:

1. define a new User Defined Tag (ie multilingual_footer) with the following code:
$l=$_GET['lan'];
switch ($l):
case 'nl':
   echo 'Dutch footer goes here';
   break;
case 'en':
   echo 'English footer goes here';
   break;
default:
   echo 'Default footer goes here';
endswitch;

2. change the Global Content Block 'footer' to include (can be the only entry in this Block):
{multilingual_footer}

3. also add the following in template_config.php (around line 43) for more xhtml compliant code (add ALT text and close IMG tag):
"en" => '',
"nl" => ''
etc.

And you are done!

The same setup can be used for other common language dependent data also, like Meta Data. One should then not use the default {metadata} tag in the template used, but the newly defined User Tag for this to work. I know, it is not pretty, but it works!

If anyone has some other ideas or suggestions, please do :)
Last edited by Der Rudi on Sat Jun 10, 2006 3:56 pm, edited 1 time in total.
sparky

Re: Multilingual footers and other common content

Post by sparky »

That's a good idea.

I have a question and perhaps you can help me out. In my multilingual CMSMS by Katon the breadcrumb and selflink (next page/previous page) navigation always leads to my default language page since the language suffix (e.g. &lan=en) is not added to the url. If my explanation is not clear then please check http://www.zafrans.de. Do you have any solution for that?

Thanks!
Der Rudi
Forum Members
Forum Members
Posts: 56
Joined: Wed May 17, 2006 7:42 pm

Re: Multilingual footers and other common content

Post by Der Rudi »

No, sorry no solution for that. Have the same problem myself also.

Anyone else with bright ideas?
Der Rudi
Forum Members
Forum Members
Posts: 56
Joined: Wed May 17, 2006 7:42 pm

Re: Multilingual footers and other common content

Post by Der Rudi »

Ok, this is what did the trick for me:

1) defined UDT as follows:

global $gCms;
$pg_alias=$gCms->variables['page_name'];

$l=$_GET['lan'];
if ($l==false) $l='en'; //default when no language selected
switch ($l):
case 'nl':
   echo 'Some Dutch text | Naar boven
Some more Dutch text';
   break;
case 'en':
   echo 'Some English text | Back to Top
Some more English text.';
endswitch;

It takes the page_alias and uses that do make a dynamic anchor for the 'Back to top' link.

2) I've also had to tweak function.lanselector.php to allow for mod_rewrite to work properly. This is also the fix for sparky's problem.
    Edit the file around line 35 as follows:
//$thepage = (isset($params['defaultpage']) ? $params['defaultpage'] : 'home.html');
if (isset($params['defaultpage']))
{
$thepage =$params['defaultpage']);
}
else
{
$thepage = $gCms->variables['page_name'];
$thepage .= '.html';
}

3) insert UDT in the template where you want it; in my case the footer

4) set $config['assume_mod_rewrite'] = true; in config.php. I am using the following (default) .htaccess file:
AddDefaultCharset UTF-8

RewriteEngine On

#Rewrites page.shtml as index.php?page
RewriteCond %{REQUEST_FILENAME} !-f [NC]

RewriteRule ^(.+)/(.+)\.html$ index.php?page=$2&lan=$1 [QSA]

5) done!

This works for me, but maybe someone else has a better way of doing this? Do note that this is working on the 0.12.2 multilanguage version from katon, so might not work with other versions!
Last edited by Der Rudi on Sat Jun 10, 2006 3:55 pm, edited 1 time in total.
Post Reply

Return to “Modules/Add-Ons”