Oh great!!! how do i get this working for my website?

Wednesday, January 19, 2005 by joeKnowledge | Discussion: WinCustomize Talk

Calling an external script should work... but it doesn/t

I'm trying to avoid php scripting and MySql for now and one way to organize text stories is to have them externally linked to somewhere else. That way I can just wrtie the story, then change it when I want to.

I am using the ducument.write i a text file and linking the text file to the spot on the page

script language = javascript text = "text/javastipt" src = "externalscript.txt"

But it won't work!!!

The file is in the same directory as the html file its suppossed to write on... ooooohhh what a world!!!!

any help on this?
(By the way, it suppossed to work on all browsers)
horiz0n
Reply #1 Wednesday, January 19, 2005 2:54 AM
I'm lost, perhaps an example of what you want?

I'm thinking a simple iFrame might do what you're looking for.
Matchbook
Reply #2 Wednesday, January 19, 2005 3:46 AM
Um, you using a CMS of any kind...?
joeKnowledge
Reply #3 Wednesday, January 19, 2005 4:46 AM
Well, its javascript, not CSS.

This is what is suppossed to happen.

I have a javascript on another page. That javascript I call externaljavascript. All it does is put text on a webpage.
EX:
document . write (" This is just the beginning! ")
Without the spaces of course.

I save that as a txt file and place it on the server within the same folder as the html page it is suppossed to write on

Now on the webpage it is suppossed to write on... well it won't.

In the body of the webpage I put:

< SCRIPT LANGUAGE = " Javascript " TYPE=" text/javascript " scr = " gamessection2.txt">

< /SCRIPT >
(again, without the spaces)


In the book, it says it is suppossed to import the javascript and run it. When it runs, its suppossed to write the text:
This is just the beginning!


So far so bad... It must be something... a quote, a line something I am missing that I am just not seeing.


Also:
I don't know css as well as I would like (which is slowing me down in making a FireFox skin too) but I think I could do this with a div tage, but I am not sure. I think I can have a div tage 'write' something on the html document.

Basically what I am trying to do is set up my website so it is easier to edit text stories with out making a dynamic database. I write a story in a text file and the javascript calles it and puts it on the page. I can change content from one source.




Man... I really need to learn this building a website stuff faster! Eventually I will have to learn php amd MySQL.
joeKnowledge
Reply #4 Wednesday, January 19, 2005 6:27 AM
arg...
I spelled 'src' as 'scr'

That is why it wouldn't work.

Now it works but I can't just type like I want to. I want to be able to just type and the webpage externally link to what I types in the text file.

Anyway, I finally came up with the word combination on Google to get me what I want


http://www.webmasterworld.com/forum21/6602.htm

The only problem will be is if the person has javascript off then they won't see anything!!!

I also found some other solutions too. I could turn the html to php and have a php include. I think that would work. The only thing is that I have to upload it to test it. php doesn't work on my computer so I can't render the webpages until its on the server.

You even felt like your just spinning your wheels and gong nowhere fast?
Matchbook
Reply #5 Wednesday, January 19, 2005 8:32 AM
BTW: If you need a speedy response on more advanced web coding/etc head over to Sitepoint.com
I always get a quick response there.
joeKnowledge
Reply #6 Wednesday, January 19, 2005 10:35 AM
Thanks for the help you guy! And thanks for the url to SitePoint. Cool site.
Matchbook
Reply #7 Wednesday, January 19, 2005 3:34 PM
Well.. I didn't really answer any of your questions. I figure most at that site are more qualified than myself. heh..
dan.wright
Reply #8 Thursday, January 20, 2005 1:04 AM

Does your server run php? If so, couldn't you just use an include statement

  • < ? include "externalfile.txt" ; ? >

Or, maybe I'm misunderstanding what you're wanting?

I realize this involves php scripting, but it does avoid the javascript issue with browsers, and doesn't involve mysql or anthing to heavy php-wise.

joeKnowledge
Reply #9 Thursday, January 20, 2005 3:41 AM
Yeah, It does run PHP and I actually got the answer I wanted by visiting Site Point and other sites like javascript.internet.com

You can, of course, have a include for javascript from somehwere else on the net, but the problem is that commas in whate ever you want the Javascript to write on the HTML page can be a problem.

There is a way around that by using the \" but can get complex when you have allot of code to place.


In he end, I am going to use the php included statement. The only problem for me is that I have to upload it to the server to see how it looks on the webpage (for my system is not linux).


At anyrate, this will make it easier to organize stories and active them as well.
I am really excited about this!!! I couldn't sleep because I was so excited. Really.
dan.wright
Reply #10 Thursday, January 20, 2005 10:18 AM
This is just my curiousity kicking in here, but why can't you test it on your machine?
joeKnowledge
Reply #11 Thursday, January 20, 2005 4:43 PM
It doesn't run php extention. so test.htm will run but test.php won't
I have XP Home.
dan.wright
Reply #12 Thursday, January 20, 2005 11:03 PM
Gotcha. Have you checked out this for a personal web server on XP Home? (Link)

I honestly haven't tried it as I run XP Pro, but it might be worth a shot.
joeKnowledge
Reply #13 Friday, January 21, 2005 12:18 AM
Cool. I will see what it does for me.
paxx
Reply #14 Friday, January 21, 2005 7:12 AM
Just install any web server such as Apache (http://httpd.apache.org/download.cgi) and then install the PHP server (http://ca3.php.net/get/php-4.3.10-installer.exe/from/a/mirror) and you'll be all set.

Please login to comment and/or vote for this skin.

Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:

  • Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
  • Access to a great community, with a massive database of many, many areas of interest.
  • Access to contests & subscription offers like exclusive emails.
  • It's simple, and FREE!



web-wc01