yarman Posted September 12, 2006 Share Posted September 12, 2006 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 | contactI 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! Quote Link to comment Share on other sites More sharing options...
hostfreak Posted September 12, 2006 Share Posted September 12, 2006 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. Quote Link to comment Share on other sites More sharing options...
yarman Posted September 12, 2006 Author Share Posted September 12, 2006 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. Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 12, 2006 Share Posted September 12, 2006 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. Quote Link to comment Share on other sites More sharing options...
yarman Posted September 12, 2006 Author Share Posted September 12, 2006 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.