Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 257
  • Last Modified:

Display a text file within a webpage

I am not sure the best way to do this but I am trying to overlay/import a text file in its entirety onto a website. The text file resides on the web  (example.site/rooms/schedule.txt). It is a simple text file, here is an example of what it looks like.

room 215
Education Reform
8:00am - 10:00am

room 218
Website stuff
9:30am - 11:00am

So all I want to do is have a simple header on the page and then list the text file and then have a footer. Is there an easy way to do this? Thanks
2 Solutions
include 'rooms/schedule.txt';
Marco GasiFreelancerCommented:

With php you can use include statement (http://www.php.net/manual/en/function.include.php)

You can use a normal html page, but give it a php extension, so mypage.html becomes mypage.php

Write you normal html code with doctype, head tag, body, header, footer and so on.

Then, exactly where you want your text file appear write this

<?php inclòude('rooms/schedule.txt'); ?>

You only have to adjust the file path accordingly your page location and all text will magiùcally apeear on your web page! :-)

Marco GasiFreelancerCommented:
oops, forgot to refresh...o
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Just make a simple page, and at the point where you want the text inserted do....

<object width="625" height="300" type="text/plain" data="http://www.mydomain.com/message.txt" border="0" >

Set the width, height and border for the text box as you wish.
teedo757Author Commented:
I dont think I will be able to use the include command since the source URL is on an external server. I will try the object command and see if that works.
Lukasz ChmielewskiCommented:
Mohamed AbowardaSoftware EngineerCommented:

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now