codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Insert Contents of .txt file into a .html page  osirisjem at 03:25 on Sunday, May 29, 2005
 

I am trying to "Insert Contents of .txt file" into a .html page. They both reside in the same directory.

The html file is called index.htm
The text file is called notes.txt

It resides on my intranet.

This should be easy .. I dont want anything fancy.

Thank you :)



  Re: Insert Contents of .txt file into a .html page  tgreer at 15:06 on Thursday, June 02, 2005
 

HTML can't do this. You'll need server-side code. Do a web search on "server side include".


  Re: Insert Contents of .txt file into a .html page  Troy Wolf at 21:20 on Sunday, June 05, 2005
 

Tgreer is right. Your question is not an "HTML" question, but if you had know that, you probably would not have needed to ask the question in the first place.

If your intranet site is hosted on a Windows webserver, you probably by default can serve .ASP pages. I don't think SSI (Server-side includes) will be enabled by default, but like tgreer said, look that up to figure out how to enable it in IIS if it is not already.

Then you can just rename your .HTM/.HTML page to .ASP and do something like this:
<html>
<body>
<pre>
<!--#include virtual="/test.txt"-->
</pre>
</body>
</html>


By naming this file something.asp, it allows the webserver to process the file rather than just serve it. Even though the page does not have any ASP code in it, you need to name it .asp for the include directive to be processed.

If your web server is apache on linux, then you can do the exact same thing--just name the file with a .PHP extension. Again, you may need to configure the webserver to allow SSI.
Troy Wolf: site expert
SnippetEdit Website Editor


  Re: Insert Contents of .txt file into a .html page  osirisjem at 02:43 on Monday, June 06, 2005
 

Is there a free version of a Webserver from Microsoft ?

My "intranet" is a bunch of .html pages that were indexed by dir2html (which just makes new index.htm files for an entire directory).

:)

How might one run a "intranet" with an Microsoft Access Backend.

Or How might I run an intranet with a backend that can easily access Microsoft Access data (in .mdb files).

:)



  Re: Insert Contents of .txt file into a .html page  osirisjem at 02:45 on Monday, June 06, 2005
 

Do you think there might be some .cgi code that might do that ?

Or some locally executed Java code ?



  Re: Insert Contents of .txt file into a .html page  Troy Wolf at 03:12 on Monday, June 06, 2005
 

Whoa! Whoa!...don't go CGI and Java on me! :)

It's much simpler than that. Microsoft, the king of licensing and squeezing every penny out of every line of code does in fact offer a free webserver--Microsoft Internet Information Server (IIS). In fact, it's the #2 webserver in use on the Internet. (Apache is #1.)

Apache is open-source and runs on Unix, Linux, MacOSX and Windows. I'd recommend it, but it can be very daunting for a new user. And for what your purposes are, IIS will serve you very well. No reason to make this difficult.

IIS is freely available for Windows server versions. You can also run IIS on XP Pro, but it has a 10 user connection limit (I think).

So hopefully you have a Windows 2000 or 2003 server on your network? If so, you can install IIS using the Add Windows Components wizard. You may need your Windows CD.

Once installed, you use the IIS Manager to administrate the IIS service.

I don't really have the time to walk you through step by step on this, but just search Microsoft for IIS information. With IIS you'll be able to run ASP scripts. With ASP, you can work with data sources including Access mdb files.

You are at the beginning of a rather long journey, my friend. But your patience and discipline will be rewarded!





Troy Wolf: site expert
SnippetEdit Website Editor


  Re: Insert Contents of .txt file into a .html page  metan at 14:41 on Wednesday, May 17, 2006
 

use PHP for crist sake!
www.w3schools.com

search file operations and stuff.. easy code.
regards.

  Re: Insert Contents of .txt file into a .html page  esapplications at 15:57 on Friday, August 11, 2006
 

Although a server scripting language will give you the most control over your presented code in the browser, sometimes I find it necessary to wirte javascript to maintain some unity in the existing code structure. The following javascript will give you what you require w/o having to program on the serverside.

(Save this as a text file) : m_menu.txt
---------------------------------------------------------------------
// Script provided by esapplications.com
var m_count = 0;
m_items = new Array(
"<a href=''><font color='#ffffff'><b>Menu Item 1</b></font></a>",
"<a href=''><font color='#ffffff'><b>Menu Item 2</b></font></a>",
"<a href=''><font color='#ffffff'><b>Menu Item 3</b></font></a>",
"<a href=''><font color='#ffffff'><b>Menu Item 4</b></font></a>"
)
while (m_count < 4){ // equals the # of m_items
document.write(m_items[m_count]+"<br>");
m_count++;
}

---------------------------------------------------------------------
insert this code in your html page:
---------------------------------------------------------------------
<script Language="Javascript" type="text/javascript" src="m_menu.txt"></script>




Happy Coding,

Craig S. Baucom
esappications.com





  Re: Insert Contents of .txt file into a .html page  draftsman at 23:23 on Wednesday, July 23, 2008
 

how about this:

<object width='100%' height='500' type='text/plain' data='textfile.txt' border='0' ></object>


  Web Hosting  jobssave at 12:05 on Tuesday, July 29, 2008
 


Web Hosting



http://www.webspacehosting.in


Web Space Hosting is a free research guide to help users in India
to choose the right web host for their personal or business site.
Our focus is on providing a simple, easy to follow web site
to help users in India choose the best web hosting plan,
most suitable for a small site or for a large e-commerce web site.
The web hosting sites, which were rated highest in the industry,
are listed below and are rated based on affordability, reliability,
uptime and tech support.

  Re: Insert Contents of .txt file into a .html page  ragus33760 at 19:25 on Wednesday, November 12, 2008
 

That was nice it created a text box but didnt read info from file

  Re: Insert Contents of .txt file into a .html page  TrabajarJuntos at 12:32 on Friday, February 19, 2010
 

<object data="archivo.html" type="all" width="600"></object>
o
<object data="archivo.txt" type="all" width="600"></object>
funcionan.

  Re: Insert Contents of .txt file into a .html page  awilders at 02:01 on Wednesday, September 01, 2010
 

This code works perfect for me....except the text is black on a dark gray background. I want to have a text file with a band's show dates and locations in it. This small file can be simply edited and the web page is updated. I really have no time to start learning all of the other cool ways to make this work, and this script gives me hope. Is there a way to make the text a particular color? I have a page I am editing that uses css for the page layout, colors, and size.

  Re: Insert Contents of .txt file into a .html page  cygo at 12:42 on Thursday, October 21, 2010
 


Copy the text you want to insert, open the .html with your text editor and paste the text where you want it.












Useful Links



CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
• Run a program both on windows and linux
• VERO.SurfCAM.v2014
• Schlumberger.Petrel.V2013.2
• Petrel.V2013.2
• Altair.HyperWorks.v12
• VoluMill.v6.1
• VoluMill.NEXION.6
• VERO.SurfCAM.v2014
• Schlumberger.Petrel.V2013.2


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2014