Php skinning w/ cookies question.
Moderator: General Moderators
Now as I said in my previous post, if I were to set ver.php to
<? $ver = "en" ?> then my index.php would show my index page. if I set it to $ver = "de" it would show my german page.
On the ver page, the job it has is to open the cookie up and find what it needs to set $ver to so that index.php knows what to load.
On the set page, it has to be able to set the cookie to either en or de, depending on what (set.php?blah=blah2) blah2 equals.
Edit: with the set.php page, I want to be able to put a link to be able to switch between the "en" and "de" side.
<? $ver = "en" ?> then my index.php would show my index page. if I set it to $ver = "de" it would show my german page.
On the ver page, the job it has is to open the cookie up and find what it needs to set $ver to so that index.php knows what to load.
On the set page, it has to be able to set the cookie to either en or de, depending on what (set.php?blah=blah2) blah2 equals.
Edit: with the set.php page, I want to be able to put a link to be able to switch between the "en" and "de" side.
Last edited by theda on Sat Feb 19, 2005 2:47 pm, edited 1 time in total.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
http://dumbass.ionichost.com/set.php?ver=super
at least it sets now, using the correct variable name.
what does index.php's code look like?
Code: Select all
HTTP/1.1 200 OK
Date: Sat, 19 Feb 2005 20:45:56 GMT
Server: Apache/1.3.26 (Unix) PHP/4.0.6
X-Powered-By: PHP/4.0.6
X-Accelerated-By: PHPA/1.3.3r2
Set-Cookie: language=super; expires=Sat, 26-Feb-05 20:45:56 GMT
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html
<noscript><script language="JavaScript">win155 = window.open('','cons723'); win155.blur();self.focus();var url = "http://" + self.location.host;var file = "/locmntl/hotfreebies.html";if (win155.document.URL.indexOf(url) == -1) { win155.location.href = url + file; }</script>what does index.php's code look like?
Code: Select all
<?php
include("ver.php");
// Style settings
include($ver."/style.php");
// Page identification
if (isset($id)) {
$id = $id;
} else {
$id = $ver."/news";
}
// Page Information Identification
if ($ver =="en" || $id == "news") {
// readable
$sec_i = "Read about my eventful life here and make your judgements swiftly.";
} elseif ($ver =="en" || $id == "gallery") {
// viewable
$sec_i = "Look through snapshots of my life and criticize them as you feel.";
} elseif ($ver =="en" || $id == "link" || $id == "cont") {
// valuable
$sec_i = "If you actually like what is on this site, all the information you need is here.";
} elseif ($ver =="de" || $id == "link" || $id == "cont") {
// valuable
$sec_i = "Wenn Sie diese Netplatz magen, dann hier ist, alles das Sie möchten.";
} elseif ($ver =="de" || $id == "news") {
// readable
$sec_i = "Lesen Sie über meinem Leben und machen Sie eiligen Urteile.";
} elseif ($ver =="de" || $id == "gallery") {
// viewable
$sec_i = "Schauen Sie durch meinen Galerien und bemängeln Sie mir, dass Sie möchten.";
}
// Begin output of page...
include($ver."/content.php");
?>
<noscript>It stands for (if $ver = en), then it inputs "en/page.php"
Currently, all my files are in three directories. "en/" "de/" and "/" the main files like index.php, ver.php, and set.php are all in the "/" and the website content is in both "en/" and "de/"
feyd |
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
visiting http://dumbass.ionichost.com/set.php?ver=en
then http://dumbass.ionichost.com/ should display data, however your logic for checking $id is off, as your default will be "en/news" not "news"
then http://dumbass.ionichost.com/ should display data, however your logic for checking $id is off, as your default will be "en/news" not "news"
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
I'd suggest using a nested set of switches
Code: Select all
switch($ver)
{
case 'de':
switch($id)
{
case 'link':
case 'cont':
$sec_i = 'Wenn Sie diese Netplatz magen, dann hier ist, alles das Sie möchten.';
break;
case 'news':
default:
$sec_i = 'Lesen Sie über meinem Leben und machen Sie eiligen Urteile.';
break;
}
break;
case 'en':
default:
switch($id)
{
// etc
}
break;
}