Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

HTML reading TXT file?


  • Please log in to reply
4 replies to this topic

#1 patbox

patbox

  • Members
  • 456 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:02:15 PM

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) :-)

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:07:15 AM

Posted 05 May 2009 - 10:17 PM

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:

#3 patbox

patbox
  • Topic Starter

  • Members
  • 456 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:02:15 PM

Posted 06 May 2009 - 12:04 PM

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 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:07:15 AM

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.

#5 KamakaZ

KamakaZ

  • Members
  • 739 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Victoria
  • Local time:12:15 AM

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.

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.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users