Php skinning w/ cookies question.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

That would give the same information as before?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it doesn't replace everything in the script, if that's what you are asking.
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Oh no. Also, when I use what you suggested, It will only place the "news" info... (If that made no sense, go to: http://dumbass.ionichost.com and click all the links below (not rooster or jara).

Edit: This is what it looks like now (index.php)

Code: Select all

<?php

include("ver.php");

// Style settings
include($ver."/style.php");

// Page identification
if (isset($id)) &#123;
	$id = $id;
&#125; else &#123;
	$id = $ver."/news";
&#125;

switch($ver)
&#123;
  case 'de':
    switch($id)
    &#123;
      case 'link':
      case 'cont':
        $sec_i = 'Wenn Sie diese Netplatz magen, dann hier ist, alles das Sie möchten.';
        break;
      case 'gallery':
        $sec_i = 'Schauen Sie durch meinen Galerien und bemängeln Sie mir, dass Sie möchten.';
        break;
      case 'news':
      default:
        $sec_i = 'Lesen Sie über meinem Leben und machen Sie eiligen Urteile.';
        break;
    &#125;
    break;

  case 'en':
  default:
    switch($id)
    &#123;
      case 'link':
      case 'cont':
        $sec_i = 'If you actually like what is on this site, all the information you need is here.';
        break;
      case 'gallery':
        $sec_i = 'Look through snapshots of my life and criticize them as you feel.';
        break;
      case 'news':
      default:
        $sec_i = 'Read about my eventful life here and make your judgements swiftly.';
        break;
    &#125;
    break;
&#125;






// Begin output of page...
include($ver."/content.php");

?>
<noscript>

feyd | :roll: edit: bah, I was close... XD - theda
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

all your links refer to $ver/script_name

the code is built to use 'script_name' (minus quotes)

it is dangerous to blindly include a file :: e.g. http://dumbass.ioinchost.com/?id=not_here
viewtopic.php?t=25394
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

I read that page, but it didn't make much sense.

Edit: I figured out what you meant, and fixed the minor glitch. Back to what we WERE talking about earlier.
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Now how do I get the cookie to be read and put the info into the script.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

refer to my last post.
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

So I shouldn't use ?blah=page ?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

?id=page not ?id=en/page :roll:
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

But I need to if I am going to have two different websites (well same website, different languages)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

no, you don't. $ver is already known through the cookie.
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Mmk, I removed that part (did some shuffling around to get it working)
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Now onto what I originally needed help with. Now how do I integrate cookies, and make them replace $ver with either en or de?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it's already being done.
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

No. I currently set $ver to "en". ($ver = "en")

Edit: That's because I could never get a cookie saved ^_^

All I need now, (Which is what I started out with)

1. setcookie() function page ("set.php") that I can do "set.php?set=en/de" and it will save a cookie with either en or de.
2. open that same cookie when I load index.php (which currently, to get $ver, it opens a second page ver.php) and detect what $ver should turn into.
Post Reply