Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Location
    Small cave on Mars
    Posts
    15

    Read and write from text file?

    Can you use javascript to load text from a text file and display on the page as if it was in the html. And is it possible to have certain people able to write to that text file.
    I need it for a news thing. I have made the site but the person the site is for needs to be able to edit the news content without having to upload a whole new page each time.

    Is this possible with javascript?

  2. #2
    Join Date
    May 2002
    Location
    Stockholm, Sweden
    Posts
    6
    Hi Chris! Yah, you can certainly do the "reading" of the text file using Javascript, and insert it wherever you please. There's a few hacks needed to get the text and insert the "innerHtml" into a <div> usually. See a good tute for this at DHTML Nirvana at http://www.dhtmlnirvana.com/alchemy/externalload.htm - but this will only do the first bit of this for you.

    Then you want to write text to a file on the server, and you can't do this with Javascript. For this, you're going to need to learn PHP or Perl, easy enough languages to learn, but this is not a simple task if it's your first!

    Tell me, what level of coder are you now? If you're still a newbie coder, you might be best served with one of the pre-packaged open-source PHP publishing tools. Go check out the open source stuff available for free downlaod at http://php.foundries.sourceforge.net/index.pl - you'll find lots of cool tools to play with, perhaps someone has already written the package you're looking for?

    Your pal, -doc-

  3. #3
    Join Date
    May 2002
    Location
    Small cave on Mars
    Posts
    15
    Well, thanks Doc.

    I have done html for a while but have never really advanced far with it. I have downloaded a whole load of cgi scripts written in perl as well as javascripts but i have never really tried to learn the languages, although i mean to try sometime.

    I have recently looked at some phjp but am not too sure about how the server reads the php.

    I have looked around at places like hotscripts.com to find news updater scripts but thery all seem too advanced for all i need.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •