Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 04:33:44 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155511 Posts in 21712 Topics by 7738 Members
Latest Member: chris85
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Test on languages  (Read 515 times)
Luckyluke

Offline Offline

Posts: 555



« on: August 22, 2009, 12:16:30 AM »

Hi,

I've got a problem.
In my template I use the folowing code:

Code:
<h1>Foto's</h1>
<p style="text-align: center;"><a href="http://www.domein.be/nl/fotos.php">Klik hier voor foto's</a></p>
<p style="text-align: center;">[[RandomImage?dir=fotoweek]]</p>
But, I've got a site with 3 language so if you click on the above link, you allways got the NL part of the site.
So, I want something like

Code:

if $language = "NL"

<h1>Foto's</h1>
<p style="text-align: center;"><a href="http://www.domein.be/nl/fotos.php">Klik hier voor foto's</a></p>

elseif $language = "FR"

<h1>Photos</h1>
<p style="text-align: center;"><a href="http://www.domein.be/fr/fotos.php">Cliquez ici pour les photos</a></p>

else

<h1>Photos</h1>
<p style="text-align: center;"><a href="http://www.domein.be/en/fotos.php">Click here for photos</a></p>

endif

<p style="text-align: center;">[[RandomImage?dir=fotoweek]]</p>


I want this in my template, do I have to use <?php ... ??
I'm not a php coder so for me this is something like flying the Concorde...  grin

Thxalot!
Grtz,
Luc
Logged
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #1 on: August 22, 2009, 01:55:15 AM »

We all experienced some dificulties with droplets in wb 2.8

You shlud try a workaround:

Make a hidden page with random section module

then include this code instead droplet:

Code:
<?php
// Change to the number you need!
$section_id 65;

// Get requested section for requested page
$query_sections $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE section_id = '$section_id' ");

// Make sure there is one
if($query_sections->numRows() > 0) {
    
$section $query_sections->fetchRow();
    
$section_id $section['section_id'];
    
$module $section['module'];
    require(
WB_PATH.'/modules/'.$module.'/view.php');

?>


find your section id in page -> sections and then replace id to this line: $section_id = 65;

Also pleas post this to droplets page Smiley so that Ruud can see what is wrong with droplet Smiley

I hope I helped Smiley

cheers
« Last Edit: August 22, 2009, 01:57:03 AM by crnogorac081 » Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
FrankH

Offline Offline

Posts: 735


WWW
« Reply #2 on: August 22, 2009, 06:58:19 AM »

For multilanguage pages, you can always try Easy Multilanguage Link, probably the most easiest way to offer links to pages with the same content in other languages.

May be the article Comfortable multilingual sites is useful, too.
« Last Edit: August 22, 2009, 07:04:14 AM by FrankH » Logged

Ochs und Esel in ihrem Lauf
halt ich leider auch nicht auf
Luckyluke

Offline Offline

Posts: 555



« Reply #3 on: August 22, 2009, 07:46:45 AM »

Hi,

Sorry, my question wasn't clear  undecided
The multilanguage site works perfectly.
But a template does not know if the pages are Dutch, French or English.
That's why we need to test the language inside the template to do some certain action.

Grtz,
Luc
Logged
FrankH

Offline Offline

Posts: 735


WWW
« Reply #4 on: August 22, 2009, 08:01:37 AM »

The multilanguage site works perfectly.
But a template does not know if the pages are Dutch, French or English.

Why not, have you tried using the build in WB value LANGUAGE ?
Logged

Ochs und Esel in ihrem Lauf
halt ich leider auch nicht auf
Luckyluke

Offline Offline

Posts: 555



« Reply #5 on: August 22, 2009, 08:07:14 AM »

The multilanguage site works perfectly.
But a template does not know if the pages are Dutch, French or English.

Why not, have you tried using the build in WB value LANGUAGE ?


We're comming closer to the solution  grin
I know I have to test with the WB value LANGUAGE. But here's my weak point, I'm not a php coder.
Logged
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #6 on: August 22, 2009, 11:25:56 AM »

Hi,

try this code:

Code:
<?php
if ( LANGUAGE =="EN") {
  echo 
"Language is english";
} elseif (
LANGUAGE =="FR") {
  echo 
"This is french";
} else {
  echo 
"This is Dutch!";
}
?>


Put it in your template and seewhat happens. If it works, replace echo line with the code you need Smiley)

cheers
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!