?
Solved

Best language for displaying a text file's data in an html page

Posted on 2003-03-24
15
Medium Priority
?
341 Views
Last Modified: 2013-11-18
I don't have cgi access, but I am allowed a script that writes form data to a text file that I do have access to. I'm looking for a way to display the text file's data in a web page. . like a guestbook. Using the <pre> tag would be acceptable too.
0
Comment
Question by:derhamm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
  • 2
15 Comments
 
LVL 2

Expert Comment

by:tconnolly
ID: 8199631
well if your hosting server allows Server Side Includes, then you could use an SSI command to bring in the text file. No real special coding required, just go about coding your page and then when you want to bring in the contents of the text file, put the following code in:


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

you could even control formatting (albeit somewhat limited) by surrounding the command with <p> tags or other tags and use CSS to control the properties

the only other thing to remember is yto name your files with a .shtml extension...

hope this helps:)

TomC
0
 

Author Comment

by:derhamm
ID: 8199666
Sounds great. Tried it but the text isn't displayed. I'm sure it's because the 80Megs of free webspace Earthlink provides it's broadband subscribers doesn't include SSI. Haven't read that anywhere but I assume it's probably the case. Just in case, is there something I need at the head of my .shtml code? Thanks for the info.
0
 
LVL 2

Expert Comment

by:tconnolly
ID: 8199724
copy and paste the code for me so i can check... also do you have any details on what earthlink provides you or if you give me your url, i can try to see what type of server your site is on and perhaps i can give you more info
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:derhamm
ID: 8200272
Here's the link:
http://home.earthlink.net/~denhamm/append.shtml

Here's the code:
<html>
<head>
<title>Sample Form</title>
</head>

<body>
<h1>Sample Form</h1>
<hr>

<form method="post" action="http://home.earthlink.net/cgi-bin/appendto">
<input type="hidden" name="appendfile" value="data/formresults.txt">
<input type="hidden" name="thankURL" value="http://home.earthlink.net/~denhamm/append.shtml">
<p><b>Name:</b><input type="text" name="name" size="30">
<br><b>Email:</b><input type="text" name="email" size="30"><p>
<b>Comments:</b>
<br><textarea name="comments" rows="10" cols="50"></textarea>
<p><input type="submit" value="Send">
<input type="reset" value="Clear">
</form><p>
<hr>

<!--#include file="data/formresults.txt" -->

</body>
</html>
0
 

Author Comment

by:derhamm
ID: 8200376
Here's the link:
http://home.earthlink.net/~denhamm/append.shtml

Here's the code:
<html>
<head>
<title>Sample Form</title>
</head>

<body>
<h1>Sample Form</h1>
<hr>

<form method="post" action="http://home.earthlink.net/cgi-bin/appendto">
<input type="hidden" name="appendfile" value="data/formresults.txt">
<input type="hidden" name="thankURL" value="http://home.earthlink.net/~denhamm/append.shtml">
<p><b>Name:</b><input type="text" name="name" size="30">
<br><b>Email:</b><input type="text" name="email" size="30"><p>
<b>Comments:</b>
<br><textarea name="comments" rows="10" cols="50"></textarea>
<p><input type="submit" value="Send">
<input type="reset" value="Clear">
</form><p>
<hr>

<!--#include file="data/formresults.txt" -->

</body>
</html>
0
 

Author Comment

by:derhamm
ID: 8200666
Here's the link:
http://home.earthlink.net/~denhamm/append.shtml

Here's the code:
<html>
<head>
<title>Sample Form</title>
</head>

<body>
<h1>Sample Form</h1>
<hr>

<form method="post" action="http://home.earthlink.net/cgi-bin/appendto">
<input type="hidden" name="appendfile" value="data/formresults.txt">
<input type="hidden" name="thankURL" value="http://home.earthlink.net/~denhamm/append.shtml">
<p><b>Name:</b><input type="text" name="name" size="30">
<br><b>Email:</b><input type="text" name="email" size="30"><p>
<b>Comments:</b>
<br><textarea name="comments" rows="10" cols="50"></textarea>
<p><input type="submit" value="Send">
<input type="reset" value="Clear">
</form><p>
<hr>

<!--#include file="data/formresults.txt" -->

</body>
</html>
0
 
LVL 2

Expert Comment

by:tconnolly
ID: 8203053
ok, well it appears that earthlink is running an Apache web server on a Unix platform, so you could probably try PHP...

so rename your file with a .php extension and to insert your text, use the following code...

<?php
   include("data/formresults.txt");
   ?>
0
 

Author Comment

by:derhamm
ID: 8203529
Thanks for your help tconnolly. PHP doesn't seem to work either. I think Earthlink strips us free webspace users of the basic extras most webmasters get like custom cgi, php, ssi, etc... I appreciate your help and if I don't get a working workaround in a few days I'll accept your php as an answer. Could you tell me what steps you took to find the web server and platform Earthlink is running? Thanks again.
0
 
LVL 2

Expert Comment

by:tconnolly
ID: 8203583
http://uptime.netcraft.com/up/graph/

find the form on the left hand side that says

"what's that site running?"
0
 
LVL 33

Accepted Solution

by:
shalomc earned 320 total points
ID: 8204137
Hi derhamm,
Let's suppose that yot text file is called "myfile.txt".
The following HTML code will work with any provider and display your text on any IE versions 4 and up.

<iframe  src="myfile.txt" height="100" width="100%" name="textfile" frameborder="no" scrolling="auto"/>

you can muck around with the attributes to find what suits you best.


ShalomC
0
 

Author Comment

by:derhamm
ID: 8204246
Cool! I hadn't researched that tag yet. Anything work in Netscape? I could have some javascript determine the browser and display one or the other. If nothing works in Netscape I'll just have the script write an option to open a window containing the text file.
0
 
LVL 2

Expert Comment

by:tconnolly
ID: 8204299
iframes are not supported in older versions of netscape (les than 6)
0
 

Author Comment

by:derhamm
ID: 8204336
Cool! I hadn't researched that tag yet. Anything work in Netscape? I could have some javascript determine the browser and display one or the other. If nothing works in Netscape I'll just have the script write an option to open a window containing the text file.
0
 
LVL 33

Expert Comment

by:shalomc
ID: 8204959
IE and Netscape 6 are more than 95% according to this site.

http://www.w3schools.com/browsers/browsers_war.asp

My experience shows even a larger share.

ShalomC
0
 

Author Comment

by:derhamm
ID: 8205328
I ended up using the <iframe> tag to solve my issue.

<iframe  src="myfile.txt" height="300" width="400" name="textfile" frameborder="no" scrolling="auto"></iframe>

Thanks!
0

Featured Post

7 Extremely Useful Linux Commands for Beginners

Just getting started with Linux? Here's a quick start guide that has 7 commands that we believe will come in handy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question