+ Post New Thread
Results 1 to 10 of 10
Web Development Thread, Import a text file into a live web page in Coding and Web Development; This is probably a really basic thing to do, but is beyond me at the moment! I am putting together ...
  1. #1

    Join Date
    Jan 2008
    Posts
    21
    Thank Post
    1
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Import a text file into a live web page

    This is probably a really basic thing to do, but is beyond me at the moment! I am putting together a standardised Home Page for the school, Firefox stylee, and want to have text on there taken from a .txt file which will also be kept on the server, but accessible by the Head/secretary etc for dates, messages etc.

    The trouble I'm having is I don't know how to get the .html code to go to a text file and read it. Any suggestions/ideas?

  2. #2

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,095
    Thank Post
    511
    Thanked 2,309 Times in 1,785 Posts
    Blog Entries
    24
    Rep Power
    803
    You can't do it directly with html, but you can with some form of language - either client or server side.

    Personally I would say the easiest way would be to use shtml. http://httpd.apache.org/docs/1.3/howto/ssi.html

    Or you could use php, and the include tag: http://uk.php.net/include/

    Or in javascript like this: http://www.netmechanic.com/news/vol4/javascript_no9.htm

    Or, if you're feeling evil, you could use an iframe to do it: http://www.w3schools.com/tags/tag_iframe.asp

  3. Thanks to localzuk from:

    mrlegs (29th January 2008)

  4. #3
    Joedetic's Avatar
    Join Date
    Jan 2006
    Location
    Walsall
    Posts
    1,316
    Thank Post
    6
    Thanked 13 Times in 13 Posts
    Rep Power
    21
    To extend on what localzuk has said. If you're using Apache as your webserver then a nice PHP include is what I'd use.

    If you're using IIS and don't want to switch to Apache or install PHP for IIS then you could use the SSI method that localzuk has linked to within IIS. A bit of googling will tell you how to enable shtml and SSIs within IIS.
    Last edited by Joedetic; 29th January 2008 at 12:00 AM.

  5. #4
    fooby's Avatar
    Join Date
    Dec 2005
    Posts
    351
    Thank Post
    0
    Thanked 5 Times in 4 Posts
    Rep Power
    18
    Maybe its overkill but have you looked at the EduGeek Joomla! package? this is a full featured site in one package ready to deploy on a web server.

    search here for it, its pretty smart.

  6. #5

    Join Date
    Jan 2008
    Posts
    21
    Thank Post
    1
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    It certainly seems like the direction the school is heading, and I know Joomla is quite effective as an intranet device.

    Thanks for all the ideas folks. I will attempt them in order!

  7. #6

    Domino's Avatar
    Join Date
    Oct 2006
    Location
    Bromley
    Posts
    4,020
    Thank Post
    212
    Thanked 1,164 Times in 758 Posts
    Blog Entries
    4
    Rep Power
    481
    I'd also suggest sharepoint

    we use it for our intranet and its been great!

  8. #7
    limbo's Avatar
    Join Date
    Aug 2005
    Location
    Birmingham
    Posts
    460
    Thank Post
    2
    Thanked 41 Times in 36 Posts
    Rep Power
    24
    Surely you can just just the include option that should work in basic html??

    <!--#include file="file.txt"-->

  9. #8

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,374
    Thank Post
    625
    Thanked 951 Times in 653 Posts
    Blog Entries
    2
    Rep Power
    318
    Quote Originally Posted by limbo View Post
    Surely you can just just the include option that should work in basic html??

    <!--#include file="file.txt"-->
    That only works with server-side SHTML.

  10. #9
    Friez's Avatar
    Join Date
    Dec 2006
    Posts
    839
    Thank Post
    22
    Thanked 22 Times in 21 Posts
    Rep Power
    22
    If you have PHP:

    <?php
    readfile("somedoc.txt");
    ?>

    If you want to do this in STRAIGHT HTML (no serverside stuff needed) you could use regular frames:

    <FRAMESET rows="100%">
    <FRAME src="somedoc.txt">
    </FRAMESET>

    or for the uber hack: rename the .txt to .htm!!

    or, you MIGHT just be asking for a simple thing like how to link to other documents rather than show the document on a .htm, to do this you just use a hyperlink like so:

    <a href="somedoc.txt">Some Description Here</a>
    Last edited by Friez; 29th January 2008 at 02:16 PM.

  11. #10

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,095
    Thank Post
    511
    Thanked 2,309 Times in 1,785 Posts
    Blog Entries
    24
    Rep Power
    803
    Just a quick note though - frames are not very accessible to those with poor eye-sight etc...

SHARE:
+ Post New Thread

Similar Threads

  1. Pupil Import
    By thom in forum ICT KS3 SATS Tests
    Replies: 9
    Last Post: 20th May 2009, 03:27 PM
  2. Replies: 4
    Last Post: 7th March 2007, 03:37 PM
  3. Batch: Text file -> Environment variable?
    By PiqueABoo in forum Scripts
    Replies: 5
    Last Post: 13th December 2006, 11:09 PM
  4. plasc date import
    By broc in forum ICT KS3 SATS Tests
    Replies: 6
    Last Post: 21st March 2006, 01:11 PM
  5. URLblacklist.com as text file
    By adamyoung in forum How do you do....it?
    Replies: 11
    Last Post: 9th February 2006, 02:35 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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