Closed Thread Icon

Topic awaiting preservation: Style Switcher using PHP (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12834" title="Pages that link to Topic awaiting preservation: Style Switcher using PHP (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Style Switcher using PHP <span class="small">(Page 1 of 1)</span>\

 
Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 07-25-2003 07:44

Hi, guys. How are you doing?
Well, I have been trying to figure out how to do style switcher stuff for a couple of weeks.
I was using JavaScript to do that. But it was pretty hard on me.
I found PHP switcher article in alistapart.com.
Could I ask you about that article?

Well, here is what I'd like to ask:

code:
<?php
setcookie ('sitestyle', $set, time()+31536000, '/', 'yourdomain.com', '0');
header("Location: $HTTP_REFERER");
?>



And article said:

quote:
The first step is to create a new file on your server named switcher.php and paste the following code into it. Blah blah balh~~~Then Don&#8217;t forget to put your own &#8220;yourdomain.com&#8221; into the script, or your cookie won&#8217;t be valid.



Can I ask you this? All I have to do is just copy this code on note pad then saved as php file, isn't it?
But I don't understand how to write my domain name. It said: 'yourdomain.com'. But I am using apache server installed on class room. I wrote like 'http://apache/~user20/html/switcher.php'
Is this right???

And also please look at this code:

code:
<link rel="stylesheet" type="text/css" href="<?php echo(!$sitestyle)?'red':$sitestyle ?>.css">
<link rel="alternate sylesheet" type="text/css" media="screen" href="./blue.css"/>
<link rel="alternate sylesheet" type="text/css" media="screen" href="./green.css"/>
<link rel="alternate sylesheet" type="text/css" media="screen" href="./black.css"/>



What is that href="./blue.css"? What does path mean??? I have never seen just one . in front of /. Hmm....
Please help me~.



Hiroki Kozai

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 07-25-2003 14:19

then your domain name would be 'apache'.

as for the "./blue.css", the dot signifies the current directory. (the double dot (..) signifies one directory up).
so, in 99.999% of all cases it's equal to just 'blue.css'

so long,

Tyberius Prime

rickindy
Nervous Wreck (II) Inmate

From: Indianapolis, In USA
Insane since: Jan 2002

posted posted 07-25-2003 14:26

The "your domain" part in your classroom server is probably "localhost" or maybe even "127.0.0.1". Not sure which you should use, but I'm leaning towards "localhost".

The ./blue.css is the way that the server finds the blue.css style sheet. In this case, the style sheet needs to be in the same directory as the page. The "." in front of the "/blue.css" tells the server that the syle sheet is in the same directory as the page.
Using the "./blue.css" method is what's called a relative path., as opposed to an absolute path, which might look like "C:/Program Files/Apache Group/Apache/htdocs/class/blue.css".
In the case of a relative path, the path is relative to where the current file is. In the case of an absolute path, the full pathname of the file, from the drive root , C:/ in this case is specified.

Here's a link with a brief explanation of relative and absolute pathnames. It's for Unix, but all computers work pretty much the same.
http://www.extropia.com/tutorials/unix/relative.html



Few problems in life can't be solved by chocolate

Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 07-28-2003 05:22

Hi, guys. How are you?
Many many thanks for your replies.
Did you have good week end?
C U later, mate.

Hiroki Kozai

« BackwardsOnwards »

Show Forum Drop Down Menu