Well that would work if I only had one home page.
My current design is that I have split up the 'site' in a few different php files handling different aspects of the 'site' like
home:index.php
forums:forum.php
albums:album.php
about:about.php
with a common header and footer script (but dependent on different CSS styles)
All these 'pages' are dynamically created by the corresponding php scripts and I would like the language selection (which is in the header) to be transparent to the user.
If the user is in one of the forums he/she should be able to switch language and just notice that the content I control has changed language. Text inputs from the users in albums, forums e.t.c is of course out of scope but the user interface should adapt.
I have absolutely no experience in web design (but has coding experience from embedded control systems....) so I am at loss on how to partioning the code and am starting to learn how the workings of Server-Php(MySQL)-Client.
As far as language handling goes my plan is to code all user interface texts in one php file where I replicate one tag for all languages and then I am setting the global language variable to the selected language container which then is used in the dynamically created pages.
As I said earlier, the language selection is done via html code outputted from the header script and it currently has the
<li><a href="language.php?lang=ge" title="Deutsch"><img src="./img/flag_germany.gif" alt="Image description" /></a></li>
implementation with one flag for each language.
Since the header script is common it is easier to have a common href in it but it could of course be scripted in the same way the breadcrumbs are scripted.
However the header function is taking me back to the right location except that the output is not refreshed. The language variable, $lg, is global and changed in the set_language function dependant on $GET['lang'] argument but the
header("Location: ". $_SESSION['referrer'])
function does not make the browser force the server to reread the script it calls to get the new content of $lg before producing the output.
I have tried with the following construction to no avail
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Location: ". $_SESSION['referrer']);
I am at loss but I accept that since it takes some time to understand this.
Regarding 'revamping' (I like that expression 🙂 ) the design I am starting with is pure static html and I am piggybacking on the HTML coding and corresponding CSS.
The global variables should actually be only one, $_lg is an array for all text in the selected language. Currently $lg_se, $lg_en and so forth are also global variables but I will make them defines since that is what they actually are.