can html display text file data?

Discussion in 'HTML' started by Shantha, Nov 22, 2003.

  1. Shantha

    Shantha Guest

    I would like to keep my data in a simple text file and use them
    to display in a html table. Is it possible? How?

    Thanks!
     
    Shantha, Nov 22, 2003
    #1
    1. Advertising

  2. Shantha wrote:

    > I would like to keep my data in a simple text file and use them
    > to display in a html table. Is it possible? How?


    Using server-side scripting. For example, in PHP, if you create a template
    called template.php such as:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <title><?php echo $_GET['page']; ?></title>
    <style type="text/css">
    table { border: thick dotted green; }
    </style>
    <body>
    <h1><?php echo $_GET['page']; ?></h1>
    <ul>
    <li><a href="template.php?page=myfile1.txt">myfile1.txt</a></li>
    <li><a href="template.php?page=myfile2.txt">myfile2.txt</a></li>
    <li><a href="template.php?page=myfile3.txt">myfile3.txt</a></li>
    </ul>
    <table><tr><td><pre><?php include($_GET['page']); ?></pre></td></tr></table>
    </body>

    Then call it like:

    template.php?page=myfile1.txt

    For example:

    http://www.goddamn.co.uk/tobyink/scratch/template.php?page=myfile1.txt

    With the real data being stored here:

    http://www.goddamn.co.uk/tobyink/scratch/myfile1.txt
    http://www.goddamn.co.uk/tobyink/scratch/myfile2.txt
    http://www.goddamn.co.uk/tobyink/scratch/myfile3.txt

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
     
    Toby A Inkster, Nov 22, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marek Kurowski
    Replies:
    1
    Views:
    1,017
    Mark A. Odell
    Aug 18, 2004
  2. Replies:
    3
    Views:
    909
    James Kanze
    Jun 20, 2007
  3. AAaron123
    Replies:
    1
    Views:
    1,025
    Alexey Smirnov
    Nov 17, 2009
  4. Cal Who
    Replies:
    12
    Views:
    624
    Cal Who
    Dec 22, 2009
  5. Replies:
    19
    Views:
    257
    Andreas Perstinger
    Oct 7, 2013
Loading...

Share This Page