INTERACT FORUM
Windows => Plug-in Development => Topic started by: KingSparta on July 31, 2003, 04:43:59 am
-
This is basicly for Lyrics i am working on.
Lets say i have a Text file "Test.txt" and i want to include it into a HTML file where the HTML file will pull up this text file and display it as part of the HTML file.
is there a way to do this?
If so how.
-
If your server supports server-side includes, you could do;
<!--#include file="textfiles/test.txt"-->
or whatever. You could put formatting around it, say with;
<font face=""verdana"" size=""1"" align=""center"">
<!--#include file="textfiles/test.txt"-->
</font>
etc.
-
If it's local, try this:
<html>
<head>
<title>InnerText</title>
<script language="JavaScript" type="text/javascript">
<!--
function bigger() {
document.getElementById("TXT").width="640";
document.getElementById("TXT").height="480";
}
//-->
</script>
</head>
<body>
<p><object id="TXT" data="Test.txt" type="text/plain" width="300" height="400" border="1">
</object></p>
<p><a href="javascript:bigger()">Make it bigger![/url]</p>
</body>
</html>
-
thanks, i will try this when i get home.
-
both seem to work well (thanks)
is there an advantage of one over the other?
-
is there an advantage of one over the other?
It depends upon your plans...
I think iframes are easier to use in most cases as you can treat them as normal frames with links and so on.
Objects allows some special tricks with local databases, for example.
Server-side includes require HTTP surroundings.
-
lets say i have a program that counts the number of lyrics (currently it is about 50,000 lyrics) and it writes this info into a file called "LyricsCount.txt" and if i wish to display this info into the html is there a way to push this info into a textbox or pull this info into the html without frams?
my test page
http://www.spartasoft.com/test.htm
-
If I just wanted to *display* a textfile, I would use an iframe as a box - but the backgound will always be white...
If I wanted to see the *content* with a certain font or background color, i just would not let the program write a text file but a simple html file...
If I wanted to *put the content* of the textfile into the html, I would use the "object" tag together with a standard ActiveX plugin to really *read* the text file.
(The plugin comes with IE, and it's of course only working with IE...)
Example....
lyrics.txt:
A|B|C|D|E
Blah|Tralala|Oh Girl|I love you|Huhu
html:
<html>
<head><title>Test</title></head>
<body>
<object id="Lyrics" classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
<param name="DataURL" value="lyrics.txt">
<param name="UseHeader" value="true">
<param name="FieldDelim" value="|">
</object>
<table id="MyTab" datasrc="#Lyrics" datapagesize="1" width="100%" border="1"><tr>
<td><span datafld="A"></span></td>
<td><span datafld="B"></span></td>
<td><span datafld="C"></span></td>
<td><span datafld="D"></span></td>
<td><span datafld="E"></span></td>
</tr></table>
</body>
</html>
-
If you want to see the *content* with a certain font or background color, i just would not let the program write a text file but a simple html file...
well maybe i can use the iframe without scroll and that should look like a textbox. but i wish to include this on a page thats why i do not want to write it just as an html
-
If it's just a number or short text, use iframes ;)
If it's more, look at my edited post above ;)
-
well i could not get the modfied html to work
but i guess the iframes will work.
the test page
http://www.spartasoft.com/test.htm
is working
-
King - whats your server setup?
IIS? Apache?
Windows?
Your best bet would be to use a server side scripting then you could pull in the data from the text file and do whatever you wanted with it literally.
If it's from your home server then setting up Apache with php isn't too hard.
-
Apache II
-
You might just try the SSI method: <!--#include file="path/file.txt" -->
You may have to rename your HTML file as .shtml or perhaps set the execute bit on the .html file: chmod +x file.html
thats easy for you to say, can you write a sample html for me?
I can't spell too good yet, i go to 3rd grade this Aug
-
I'm not sure how you have Apache setup, but try creating this:
test.shtml
------------
<html>
<body>
<!--#include file="LyricsCount.txt" -->
</body>
</html>
this does not work.