|
First off, sorry if this is the wrong place to post this, I dun exactly know where it should go. x-X;
Umm, I've heard from several people that externally hosting codes helps to speed up the loading of the site. I tried externally hosting once when I was trying to figure out a way to have different images and things for different skins. ...But I almost completely screwed over the site so I said "Screw this!", kept looking, and found Cali's amazing Diff Headers/Footers for Diff Skins. <3
Anyway, I wanna try externally hosting codes to speed up the load time again since I've gotten a little better with codes. So I was wondering if any one had or knew of a good tutorial/person that would give step by step instruction on how to host codes externally. o-o I don't want someone to do it for me; I wanna learn. =3 *nerd*
Last Edit: Sept 4, 2008 4:07:32 GMT by Minion Fire-san
|
|
|
|
|
Well, take random host x. Take the javascript on your page, select, cut, and paste it into a file (ie: header.js, footer.js, etc). Then upload the file to random host x. Then back on your page, take the script tags that once held your inline javascript and change them to:
<script type="text/javascript" src="http://www.randomhostx.com/~youraccount/header.js"></script>
That's the general gist of it. If you need more details about any particular part of that just ask, as I really did only give a brief overview.
|
|
|
|
o.o I rarely ever don't have questions. xD
When you copy and pasted your codes from the headers and footers to paste them in a host, do you copy the script tags, or no? o0
Does each code need to be hosted sperately?
When you go back to paste the link for your hosted codes back in the header/footer, do you paste it in every script tag you used to have, or just one?
Have a good host that you would suggest? =x
|
|
|
|
|
o.o I rarely ever don't have questions. xD
When you copy and pasted your codes from the headers and footers to paste them in a host, do you copy the script tags, or no? o0
Does each code need to be hosted sperately?
When you go back to paste the link for your hosted codes back in the header/footer, do you paste it in every script tag you used to have, or just one?
Have a good host that you would suggest? =x Do not copy the script tags, when you create a javascript file (.js) the only thing it should contain is javascript, not the the script tags which are HTML. You can group codes together, but if there are any requirements for what order they have to appear in, make sure that you maintain that order. You cannot group codes from headers with footers though (well you can, it just won't work how you want). So basically, no, they don't each have to be separate. When linking to external scripts, only link for each file that you have created, if you catch my drift. So if you create one file from global footers, you only have to link to that file once within your global footers. As far as hosting, I personally pay for mine just because I prefer to know that I am a legitimate customer that will be respected by whoever is hosting me, but there are plenty of free ones out there if you would like. I believe a fairly popular one is webpost.net, but I haven't used free hosting for a while, so I'm not the most knowledgeable source.
|
|
|
|
I know wimg.co.uk/ has recently become popular for hosting JS scripts among PB users since Wrighty (I believe) runs it.
|
|
|
|
|
I'd use Writy's...'cept I don't exactly know how to use it. x-x; Do you save the codes without the tags into a notepad document? If so, then would you have to differentiate between JS and CSS codes and put them in two different notepad documents?
Sorry I have so many questions. x-X;;; I'm trying to learn to code so hopefully you won't have to deal with me and the questions in the future.
|
|
|
|
|
Yes, you put them into notepad or something similar, then save them. And yes, scripts and styles have to be separated.
To link to styles (slightly different than scripts) you use the link tag: <link href="URL HERE" rel="stylesheet" type="text/css" />
|
|
|
|
Mkay, I think I only have one more question for the moment. o.o; On Wrighty's hosting site, I see a bunch of file names like .css, .js, .txt, .zip, etc, but the only options I have in Notepad are .txt or "All Files". o0 Is it alright to save them as .txt or do I need to figure out a way to save the CSS files as .css and the JS files as .js?
|
|
|
|
|
click on 'All Files' and then in the 'file name' just type: 'x.js' or 'x.css' .. it will then save it as that filetype!
|
|
|
|
Oh meh gaaaaaawd! Eeeeeeeeee! It works! =DDDDDDDDDDDDDDDDDDDDDD Thanks you guys! =333 *huggles all and gives cookies* Yall are awesome! <3
|
|
|
|