Jump to content


option to change between site headers?

  • Please log in to reply
4 replies to this topic

#1 yarman

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 12 September 2006 - 07:34 AM

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.


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!

#2 hostfreak

  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 12 September 2006 - 07:52 AM

Well, say you set your url parameters up like:

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


case "english":

case "spanish":


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.

#3 yarman

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 12 September 2006 - 11:22 AM

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.


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.

#4 redarrow

  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 12 September 2006 - 11:49 AM

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.
Wish i new all about php DAM i will have to learn

#5 yarman

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 12 September 2006 - 07:49 PM

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. http://www.unashamed...abic_header.php

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.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users