Staredit Network > Forums > Technology & Computers > Topic: Website Coding
Website Coding
Jul 14 2008, 7:24 pm
By: Falkoner  

Jul 14 2008, 7:24 pm Falkoner Post #1



I'm trying to set up skins for my website, and I can't seem to manage to get them to work properly, I just can't store the skins in the cookies properly or something, here's what I have:

This page should allow you to set the cookie to the correct skin:
http://falkoner.cow.googlepages.com/SkinChanger.html
Collapsable Box


This page should pull the data of your current skin from the cookie and pick a CSS depending on what's in the cookie:
http://falkoner.cow.googlepages.com/SkinTester.html
Collapsable Box


And these are the two CSS pages that I am pulling it from:
http://falkoner.cow.googlepages.com/Skin1.css
Collapsable Box

http://falkoner.cow.googlepages.com/Skin2.css
Collapsable Box


Can anyone check out the code and find what I did wrong?

Post has been edited 1 time(s), last time on Jul 14 2008, 7:29 pm by Falkoner.



None.

Jul 14 2008, 7:35 pm Cole Post #2



I know PHP better, but I can try and give this a go. I use to do some javascript.

Well for one to clean up your code, when you store the cookie you store the " " in the cookie. When you write out the stylesheet in javascript you also write out the " " again. While I would guess this would have no effect, I could be wrong and it could be trying to find a url that starts with "http:// and not http://.

However i'm doubting thats it.

Now my javascript and html are rusty as hell, however I think your setting the cookie "Skin", and checking the cookie Skin. It might just be from my experiences with C, but \" designates that you want " apart of the string. so \"Skin\" would output to "Skin" but u want Skin.



None.

Jul 14 2008, 7:38 pm Falkoner Post #3



Quote
Now my javascript and html are rusty as hell, however I think your setting the cookie "Skin", and checking the cookie Skin. It might just be from my experiences with C, but \" designates that you want " apart of the string. so \"Skin\" would output to "Skin" but u want Skin.

Yeah, I also program in C normally, and that's originally how I had it, but I talked with Doodle and he said I had to do it that way, here, I'll try it without the backslashes and see how it works out.

EDIT:

Okay:
http://falkoner.cow.googlepages.com/SkinChanger2.html
http://falkoner.cow.googlepages.com/SkinTester2.html

It still didn't work :( Perhaps something else?



None.

Jul 14 2008, 7:43 pm Centreri Post #4

Relatively ancient and inactive

I'm pretty bad at Javascript, so I don't think I can really help with this, but you'll need more then different CSS files if you want a real skin system with different elements and all that. .tpl files are what most professional skinnable scripts use, though .html and all that can be used in conjunction with PHP 'require()' to create a very dynamic skin system.



None.

Jul 14 2008, 7:44 pm Falkoner Post #5



Well, I plan on basically just changing the top picture, the backround image, and the basic CSS using cookies, this is just a test. And the main reason I have to use cookies is because GooglePages doesn't allow PHP :(



None.

Jul 14 2008, 8:03 pm Cole Post #6



You still have "Skin\" rather than "Skin" on your settings page.
I'd also change Skin on the Settings Tester page to "Skin". Keep it consistent.



None.

Jul 14 2008, 8:10 pm Falkoner Post #7



Changed it, and it still doesn't work, and on the Setting Tester page I tried it with and without the quotes, neither worked.

EDIT: Here, I'll try not doing a string, and see if I can brute-force the skins.
EDIT:

Okay, that didn't work either.. I think I just have something wrong with my code, here's the new stuff, which still doesn't work:
http://falkoner.cow.googlepages.com/SkinChanger3.html
http://falkoner.cow.googlepages.com/SkinTester3.html

Here's the tutorial I've been trying to figure this out from:
http://w3schools.com/js/js_cookies.asp

Post has been edited 1 time(s), last time on Jul 14 2008, 8:22 pm by Falkoner.



None.

Jul 14 2008, 9:45 pm Falkoner Post #8



Hey, do you need to use the escape function to put data into a cookie? Like, if I don't care whether they manually edit it or not, can I skip using the escape function all together and just put unencrypted data in the cookie?



None.

Jul 14 2008, 10:57 pm Falkoner Post #9



Okay, I think the cookie sending is working correctly, because when I checked in my Cookies I found this:

Name: Skin
Content: http%3A//Falkoner.CoW.GooglePages.com/skin1.css
Host: falkoner.cow.googlepages.com
Path: /
Send for: Any type of connection
Expires: At end of session

So I think it's the reading of the cookie that isn't working properly now. Note that this is the code I used:
http://falkoner.cow.googlepages.com/SkinChanger4.html
http://falkoner.cow.googlepages.com/SkinTester4.html

I found that strings, when put into a function, must have ' around them.

Also, I'm wondering, since it says Expires: At end of session, does that mean when I close my browser it's gone? What does that mean? I want it to never expire, how can I do that?



None.

Jul 14 2008, 11:33 pm Falkoner Post #10



I know, sorry, for quadruple posting, but I've finally gotten the exact problem, here it is:

document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"+theCSS+\">");

What is wrong with that line of code? Or what is wrong with my two CSS pages? I managed to get it to print out the URL of the CSS exactly as it was supposed to be, using the theCSS variable, so I know it's in there properly, can anyone help me out here?



None.

Jul 15 2008, 1:28 am Falkoner Post #11



FARTY IS THE BEST!

He solved it for me over MSN, thanks guys :)



None.

Jul 15 2008, 1:30 am O)FaRTy1billion[MM] Post #12

👻 👾 👽 💪

The problem (just for those who are curious):
The quotes around +theCSS+ needed to be delimiters... not escaped or singlequoted. >.>



TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
MapSketch - New image->map generator!
EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
\:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[04:15 am]
DarkenedFantasies -- you eat lots of beans
[03:46 am]
IskatuMesk -- how do i get gas
[11:43 pm]
Moose -- you don't
[10:06 pm]
Zoan -- how do i get minerals
[2026-4-14. : 11:45 pm]
ClansAreForGays -- Anyone wanna played Skewed StarCraft?
[2026-4-14. : 12:07 am]
Vrael -- NudeRaider
NudeRaider shouted: Vrael ranting still is though
you're a gentleman and a scholar, thank you
[2026-4-13. : 10:07 pm]
NudeRaider -- ya why phone people when you can just write letters
[2026-4-13. : 9:37 pm]
IskatuMesk -- I have never and will never own a phone
[2026-4-13. : 9:15 pm]
NudeRaider -- Vrael ranting still is though
[2026-4-13. : 9:14 pm]
ClansAreForGays -- anticapitalism isnt edgy anymore
Please log in to shout.


Members Online: Zycorax