Jump to content

Archived

This topic is now archived and is closed to further replies.

yarman

option to change between site headers?

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!

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
yarman did you hand code all the links in a diffrent lanuage or did you use a class to convert the links in diffrent lanuage.

grate stuff.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

×

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.