BleepingComputer.com: HTML reading TXT file?

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

HTML reading TXT file?

#1 User is offline   patbox 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 456
  • Joined: 06-February 09
  • Gender:Male

Posted 05 May 2009 - 09:25 PM

I would like to change the text on my web site frequently, but I am getting tired of constantly changing and uploading the whole HTML source code.

Is there a way, how I could tell the HTML to read the text from a TXT file? So then I would just need to change and upload via FTP the TXT file.

I have a guess, I will need JS for this?
Message from Patbox: I AM LOOKING FOR A GIRLFRIEND (PM if interested) :-)

#2 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,605
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 05 May 2009 - 10:17 PM

Quote

I could tell the HTML to read the text from a TXT file
I am pretty sure you already know the answer to that since you have already been told quite a few times that all HTML can do is display text. You could use javascript, but personally, it would be much easier with something like PHP or ASP. I bet your provider allows for one of those. :thumbsup:
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

#3 User is offline   patbox 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 456
  • Joined: 06-February 09
  • Gender:Male

Posted 06 May 2009 - 12:04 PM

Quote

I . You could use javascript, but personally, it would be much easier with something like PHP or ASP. I bet your provider allows for one of those. :flowers:


Yep, but my skills don't :-) But hey HTML can display *.jpg files, so in theory I would not feel shocked if it could display a *.txt file.

I recall, I read about a black-board script on your blog... is the code and image freely available for download?

:thumbsup:
Message from Patbox: I AM LOOKING FOR A GIRLFRIEND (PM if interested) :-)

#4 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,605
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 06 May 2009 - 12:18 PM

Everything is there, but that is done using Silverlight, which is yet another language. Feel free to nab the image if you want; I don't have the source code posted yet though. I am in the middle of migrating my stuff over to another server, and I had planned on adding source to a few of the projects there. Anyway, the text manipulation there is done with C#, so that is yet another language.

PHP is not too difficult to learn. The PHP code to read a file is pretty simple:
$myFile = "testFile.txt";
$fh = fopen($myFile, 'r');
$theData = fgets($fh);
fclose($fh);
echo $theData;


PhP is essentially just embedding php code into your HTML. Zend has some really nice tutorials.
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

#5 User is offline   KamakaZ 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 557
  • Joined: 26-August 08
  • Gender:Male
  • Location:Victoria

Posted 07 May 2009 - 08:26 PM

I agree with Groovicus, it would be a lot easier to use PHP to read a file and display the content.

that way you only have to mod the file and your done.

Most of the provider's i have dealt with have PHP. If you are hosting it yourself, PHP is not to hard to install on both *nux and Windows systems.
If I am helping you and don't reply in 24 hours please send me a PM

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users