Now You See It, Now You Don't, In need of an if/then
![]() ![]() ![]() |
Now You See It, Now You Don't, In need of an if/then
InfiniteWarrior |
![]()
Post
#1
|
![]() Emperor ![]() ![]() ![]() ![]() Group: Members Posts: 800 Joined: 21-June 03 Member No.: 20 ![]() |
For the option to turn styles off and on, I'm using this little snippet:
CODE <?php if( $_GET['css'] != 'false' ) { ?> <link rel="stylesheet" href="style.css" type="text/css" /> <?php } ?> ... and the links: CODE <a href="?css=false">Styles Off</a> | <a href="?css=true">Styles On</a> ... meaning both links are visible at all times. What I'd like to do is make one or the other disappear depending on which has been selected: "Styles Off" becomes "Styles On" and vice versa. Any of you youngsters wanna help out an old lady? |
Kyzene |
![]()
Post
#2
|
![]() Master ![]() ![]() ![]() Group: -=RJ=-Clan Posts: 498 Joined: 18-June 03 Member No.: 13 ![]() |
Reading all that crazyness made my brain hurt. C++ is so much more...normal
![]() -------------------- There is no such thing as luck, only mistakes and the people that take advantage of them.
Play Wild Jedi CTF in JA. Visit Chop Shop for crazy CTF action. Become a Pastafarian. |
Ruggiero |
![]()
Post
#3
|
![]() Lord ![]() ![]() ![]() ![]() ![]() Group: Admin Posts: 1,177 Joined: 13-June 03 Member No.: 2 ![]() |
I KNOW Liz has seen this thread.... I just don't know if he knows the answer.
![]() Rugg -------------------- Oobawanga wata chopay polah.
|
TheLizardKing |
![]()
Post
#4
|
![]() Secretive Rodian Lover Hater ![]() ![]() Group: Admin Posts: 93 Joined: 13-June 03 From: Orlando, Florida, United States of America Member No.: 1 ![]() |
well what you could do is decide what you would like to have set by default. If you want css on by default you should then just simply write some code that says something like.
<?php if (isset($_GET['css'])) { $headercss = "<link rel="stylesheet" href="style.css" type="text/css" />" $linktext = "<a href=blah.php?css=false">Styles Off</a>" } else { $linktext = "<a href=blah.php">Styles On</a>" } ?> And place the appropriate $variables where ye need them to be. -------------------- AS;LDJFA;LSKFADS
|
InfiniteWarrior |
![]()
Post
#5
|
![]() Emperor ![]() ![]() ![]() ![]() Group: Members Posts: 800 Joined: 21-June 03 Member No.: 20 ![]() |
Thanks for the edification, Msr. Lizard. 'Twould be on by default. I'll try it.
Please forgive my PHP illiteracy, but how might one write those appropriate variables when placing them? Also, I'd like "off" to refresh any page the user happens to be on and have it stay that way until the "on" link was clicked again (from anywhere), but I'm thinking a cookie would be necessary to carry the preference. Will this code avoid that? |
TheLizardKing |
![]()
Post
#6
|
![]() Secretive Rodian Lover Hater ![]() ![]() Group: Admin Posts: 93 Joined: 13-June 03 From: Orlando, Florida, United States of America Member No.: 1 ![]() |
For the variables, all you have to do is place that bit of code (its not 100% syntax correct) near the top and place the header variable in the header and the link variable where the link is
html <?php echo $linktext; ?> morehtml and for the persistant memory, you are gonna want to look into sessions. Unfortunately I am not the master of sessions so I can't help much there ![]() -------------------- AS;LDJFA;LSKFADS
|
InfiniteWarrior |
![]()
Post
#7
|
![]() Emperor ![]() ![]() ![]() ![]() Group: Members Posts: 800 Joined: 21-June 03 Member No.: 20 ![]() |
Ah, dat's ok. Should have seen the sessions coming, but I have a lifeline for those. Thank you ever so much!
~ Infi |
![]() ![]() ![]() |
Lo-Fi Version | Time is now: 23rd April 2024 - 02:48 PM |