Click to See Complete Forum and Search --> : page help


96turnerri
09-14-2003, 01:08 PM
hi i have the following coding that i wish to put on the bottom of each page of my site

<p align="center"><font color="ffffff">
<script language="javascript" src="quotes.js"></script></p>

<p align="center">
<script language="javascript" src="mistake.js"></script>
<script language="javascript" src="suggestions.js"></script>
<script language="javascript" src="vote.js"></script>
<script language="javascript" src="log.js"></script>
<script language="javascript" src="glossary.js"></script>
<script language="javascript" src="bookmark.js"></script>

<a href="javascript:openMistake()">Seen A Mistake</a>&nbsp;&nbsp;
<a href="javascript:openSuggestions()">Make A Suggestion</a>&nbsp;&nbsp;
<a href="javascript:openVote()">Vote</a>&nbsp;&nbsp;
<a href="javascript:openLog()">See Web Log / Updates</a>&nbsp;&nbsp;
<a href="javascript:openGlossary()">Glossary</a>&nbsp;&nbsp;
<a href="guestbook.htm" target="_blank">Guestbook</a>&nbsp;&nbsp;
<a href="search.htm" target="_blank">Search</a>
</p>

<p align="center">
<a href="sitemap.htm" target="_blank">Site Map</a>&nbsp;&nbsp;
<a href="#" onClick="this.style.behavior='url(#default#homepage)';
this.setHomePage('http://www.whatever.com');">
Make Us Your Homepage</A></font>&nbsp;&nbsp;
<a href="javascript:bookmark()">Click Here To Bookmark</a>
</p>

would it be possible to have it appear at the bottom of each page without having to put it all in each pages coding?

thanks
Rich

pyro
09-14-2003, 01:53 PM
Yes, with PHP or SSI (and other serverside languages). Does your server support either of those technologies?

96turnerri
09-14-2003, 03:12 PM
php no, and ssi??

pyro
09-14-2003, 03:59 PM
SSI = Server Side Includes

Do you have any serverside languages available?

David Harrison
09-14-2003, 04:39 PM
Since you're using JavaScript anyway you could just put it all in a separate .js file like this:

function writestuff(){

document.write("C O D E");

}


in the head have:

<script type="text/javascript" src="file.js"></script>


and where you want the stuff written have this:

<script type="text/javascript"><!--
writestuff();
//--></script>

pyro
09-14-2003, 04:41 PM
Yes, but 13% of users do not hava JavaScript enabled, so that method will result in inaccessable pages...

David Harrison
09-14-2003, 04:45 PM
Have you seen his code???

The only thing I've spotted with no JavaScript in is this:

<a href="sitemap.htm" target="_blank">Site Map</a>

And he could always include that just by itself anyway.

Edit: I've just seen these two as well:

<a href="guestbook.htm" target="_blank">Guestbook</a>
<a href="search.htm" target="_blank">Search</a>

So that's 3/9999 then is it?

pyro
09-14-2003, 04:50 PM
Either way, using a serverside language is best (and IMO, the only way it should be done)... http://www.w3.org/TR/WCAG10/wai-pageauth.html#tech-scripts

David Harrison
09-14-2003, 04:59 PM
I agree that all web-developers should try to accomodate dis-abled users and users who are using old browsers or have JavaScript disabled.
But in this case where clearly most of the content is created JavaScript anyway, what would be the point of using server side includes, only to include content that is JavaScript and could not be viewed by all of the types of users that I have listed above?

Edit: I do not think that it would be inappropriate to include some suitable content in between some noscript tags.6.3 Ensure that pages are usable when scripts, applets, or other programmatic objects are turned off or not supported. If this is not possible, provide equivalent information on an alternative accessible page. [Priority 1]
For example, ensure that links that trigger scripts work when scripts are turned off or not supported (e.g., do not use "javascript:" as the link target). If it is not possible to make the page usable without scripts, provide a text equivalent with the NOSCRIPT element, or use a server-side script instead of a client-side script, or provide an alternative accessible page as per checkpoint 11.4.

pyro
09-14-2003, 05:07 PM
Originally posted by lavalamp
what would be the point of using server side includesThey (or PHP includes) work better. They can include plain text (or better, HTML markup) and you don't have to worry about escaping all the content like you would in JavaScript.

David Harrison
09-14-2003, 05:11 PM
Sorry, but could you just give me clarification of what the word "escaping" means.
I've heard it before, and I know that you can unescape something in JS as well, but I don't know what they mean/do.

96turnerri
09-14-2003, 05:20 PM
ok thanks for your help i have recomended that users have js enabled anyway and a page that tells them there resolution, java script enabled etc. gonna sound really stupid i no, but all i writes on the page is whatevers in here

document.write("");

which is obvious i no, but how would i get it to say what i want it to say?

96turnerri
09-14-2003, 05:24 PM
also i could get php but dont have a clue what it does or how to use it

pyro
09-14-2003, 05:29 PM
With javascript, you will have to use document.write, which means it will look something like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<script type="text/javascript" src="test.js"></script>
</body>
</html>

and test.js

document.write('<div>',
'<p>This is the first demo paragraph</p>',
'<p>This is the second demo paragraph</p>',
'</div>');

Whereas with PHP, it would be like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?PHP
include "test.txt";
?>
</body>
</html>

and test.txt

<div>
<p>This is the first demo paragraph</p>
<p>This is the second demo paragraph</p>
</div>

With the PHP (or SSI) method, you can just use regular HTML in the included file, making it much easier, if you need to include a farily large amount of content.

96turnerri
09-14-2003, 05:31 PM
so basically what your saying is if i edited the one txt file (presuming i was using php and it was on all pages of web) all pages would be automatically updated? that sounds quite good i might have to start reading up on php. thanks again pyro

pyro
09-14-2003, 05:38 PM
Yes, that is exactly how PHP includes work... Very nice. I use them on my site to make updating easy...

David Harrison
09-14-2003, 05:50 PM
Oh, is that all escaping means, and I've been doing it all this time and I didn't know it.

I will agree with you though that using SSI's needs less code however now 96turnerri is faced with the problem of finding a PHP host.
I would suggest using ASP includes instead because I think that there are more ASP hosts out there than PHP hosts. I'm hoping to set up an account with United Hosting (http://www.unitedhosting.co.uk/) somewhere in the near future, they seem to be a fairly decent host while at the same time, dirt cheap.

pyro
09-14-2003, 06:00 PM
Actually, escaping content would probably normally mean escaping special characters relative to that language/function. But, I definied it above in the terms that I used it.

Originally posted by lavalamp
I would suggest using ASP includes instead because I think that there are more ASP hosts out there than PHP hosts.I disagree with that. Judging from the fact that 64% of servers run Apache, while only 26% run Microsoft servers (http://news.netcraft.com/archives/2003/08/01/august_2003_web_server_survey.html), it would seem quite logical that many more servers run PHP that ASP (as PHP is Apache's most common module).

I would also disagree with using ASP over PHP. PHP is portable, open source, and very easy to learn.

96turnerri
09-14-2003, 06:31 PM
ok guys thanks for your help, all sorted now :D

David Harrison
09-14-2003, 06:34 PM
Well I based my results on only a couple of searches on Yahoo and on a two minute conversation with someone at school, so maybe you are right.

I was also under the impression that ASP was easy to learn because you can use "simple" VBScript to program it in, (yeah right they said statistics was easy as well). From what you've said you might have me switching to PHP.

Now if only I could set up Apache on my machine at home, but I can't because I'm crap at that sort of stuff. I've even got a book (SAMS Teach Yourself PHP, MySQL and Apache in 24 Hours), that's supposed to make it easy and i can't even get the software that comes with it to work.

Any respect you've ever had for me: Dropping

I would try and set up IIS 5 or 6 so that I can test my ASP on my machine, rather than online but I can't even find anywhere to download it from.

Respect: Critical

Wow, I've left myself exposed and wide open to attack after this post, but at least I've voiced some of my concerns. Mostly about how crap I am with software.
This is why I like server side languages, no funny programs to install, you just open notepad and away you go.

Respect: 0

pyro
09-14-2003, 07:52 PM
Aprelium (http://www.aprelium.com/) makes a server that is easy to install and can be made to support PHP, Perl, and ASP by following the simple instructions... It's nice to have a testing server for serverside languages so you don't have to constantly be uploading pages.

96turnerri
09-14-2003, 07:55 PM
can you stop using my thread as a playground children? :p

pyro
09-14-2003, 08:07 PM
Originally posted by 96turnerri
ok guys thanks for your help, all sorted nowI believe your original question has been answered. If you have additional questions, go ahead and ask them. If not, and if you don't like the way this thread is going, you don't have to continue reading it.

96turnerri
09-15-2003, 06:56 AM
I believe your original question has been answered. If you have additional questions, go ahead and ask them. If not, and if you don't like the way this thread is going, you don't have to continue reading it.

my original question did get answered, but i did it a different way in the end, thanks anyway, and i would unsubscribe from the thread but i think its funny, to watch you two guys. :p

David Harrison
09-15-2003, 05:00 PM
Thanks for the Aprelium link, I'll have to check that out.

I'm sorry 96turnerri, I hope you'll allow this post.

pyro
09-15-2003, 05:15 PM
You're welcome... :) Hope it works for ya.

96turnerri
09-15-2003, 05:17 PM
thats ok lavalamp only joking anyway you go right ahead mate :cool:

David Harrison
09-15-2003, 05:21 PM
I though Quark was just a barman. When did he become an emissary?

96turnerri
09-15-2003, 05:25 PM
quark is a barman, DS9 is obviously the ST series and Emissary is the episode the pilot of ds9, new signature better?