Jump to content

option to change between site headers?


yarman

Recommended Posts

Allrite this is a weird question...

I have a website with say 8 main pages. I have a "php include" universal site header in english for users to navigate to these 8 pages.

Example:

home | articles | links | contact

I am wondering if it is possible somehow to let users click on something that will change their universal site header into their own language, say, chinese, until they decide to go back to the main header in english. I don't want to have to create 8 new pages for each language that "php includes" the proper language header...
I really hope this makes sense. I suck at php so any recommendations would rock. Thanks!
Link to comment
Share on other sites

Well, say you set your url parameters up like:
[code]
http://www.domain.com/page.php?language=language
[/code]

Then you add something like this on your page where the header would be:
[code]
<?php
$language = $_GET['language'];
switch ($language) {

default:
include("default_header.php");
break;

case "english":
include("enslish_header.php");
break;

case "spanish":
include("spanish_header.php");
break;

}
?>
[/code]

Then somewhere have a dropdown that has all the available languages that they can select. That has "onchange" (javascript/ajax) to where when they select something else, it changes the url parameters.
Link to comment
Share on other sites

fascinating. thanks so much. since im not very learned in coding i kinda mixed the onclick (flag images) javascript with html to get screentips and what not but everything works perfect...now just more tuning to do haha.

[url=http://www.unashamedlove.com/]http://www.unashamedlove.com/[/url]

p.s. is there a way to force the current header to not revert back to default until the user manually chooses to?

thanks again.

Link to comment
Share on other sites

yeah its actually separate header files for each language that different people volunteered to translate so it wasn't much work for me...though a few new links have been added recently that haven't been translated in each language yet which is kinda obvious haha...

i.e. [url=http://www.unashamedlove.com/_files/arabic_header.php]http://www.unashamedlove.com/_files/arabic_header.php[/url]

and then since each of my main head links is tied to a directory index file (i.e. articles/ or articles/index.php) i just made the onclick location.href=index.php the same link for every directory which saved tons of time thankfully. so then if i used the URL setup that hostfreak gave me, index.php?language=language, this link works in every directory with an index.php file.

i think that is what you were asking? thanks guys.
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.