Jump to content

menu problem using $PHP_SELF


scar5308

Recommended Posts

I am trying to set up a multi lingual web site.
Currently, the following works well as a static menu but I would like to change it to a dropdown menu using if possible, the 'select onchange=' method so the user doesn't have to click on a OK or Select button.

I would also like a message to appear in the drop down in its default state such as 'Select Language'
I have a version at: [url=http://www.webwhiz.co.uk/lang5/langselect.php]http://www.webwhiz.co.uk/lang5/langselect.php[/url] which doesn't work either.
I asked on the forum for help but nothing so far! (see Help with arrays please: [url=http://www.phpfreaks.com/forums/index.php/topic,112413.0.html]http://www.phpfreaks.com/forums/index.php/topic,112413.0.html[/url] ) I have tried to sort this out but am not really a coder. The code I have so far is:

[code]<? include_once ("./setstring.inc") ?>
<?= "<a href='" . $PHP_SELF . "?lang=pt-br'>Portuguese</a>" ?> |
<?= "<a href='" . $PHP_SELF . "?lang=fr'>Fran&ccedil;ais</a>" ?> |
<?= "<a href='" . $PHP_SELF . "?lang=en'>English</a>" ?> |
<?= "<a href='" . $PHP_SELF . "?logoff=1'>Logoff</a>" ?>

<? include ( setstring ( 'pt-br', './portuguese.php', 'fr', './french.php', 'en', './english.php') )?>[/code]

I wouldn't mind getting either to work properly, both would be a bonus! A virtual beer is on offer for anyone who can help!
Link to comment
Share on other sites

Not sure I would go about it this way but, using the variable your passing via url, I suppose one easy approach would be:

[code]<?php

  if($_GET[lang] == 'pt') {include'portuguese.php';}
  elseif($_GET[lang] == 'sp') {include'spanish.php';}
  elseif($_GET[lang] == 'fr') {include'french.php';}
 
  else{include'english.php';}

?>[/code]
Link to comment
Share on other sites

Thanks for that but I am already using something similar for the initial page.

What I wanted to do was; once the visitor has been directed to the page according to the $_GET[lang] I wanted to give them the option of selecting a different language. All the pages are just templates and the script calls up the various includes etc. according to the language detected from language specific include folders. I then wanted a drop down menu on the main page that would change the language include directory. I would therefore only have one set of pages with just the includes and perhaps some images changing according to the language either selected or detected.

Hope that's clear :-)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.