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="/forum/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='/forum/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="/forum/archivo.txt" type="all" width="600"></object>
funcionan.








CodeToad Experts

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








Recent Forum Threads
•  Re: Insert Contents of .txt file into a .html page
•  Re: Using Lucene or Solr ?
•  com ports in windows 7
•  How do I use PHP with Solr?
•  Need to enter XML content into HTML formatted email document
•  Lightweight components reuses its parents graphical units. Heavyweight components
•  lightweight and heavyweight component
•  array of struct
•  matrix prblm in java


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-2010