Log in

View Full Version : .txt --> html



joe5
02-03-2009, 01:06 AM
I'm a intermediate web designer skilled in html and css. I've been trying to learn as much java script as possible and am doing good so far. Currently I'm working on a project for my school. I'm attempting to make some what of a CMS by using .txt files that the administrators can edit themselves.

I found a script on here : http://www.dynamicdrive.com/dynamicindex2/ajaxticker.htm

This takes the html content of a .txt file into a ticker. I've been trying to pick it apart to the bare necessities of importing the content. aka: with out the ticker functions.

Any help?

Many thanks, J5.

bluewalrus
02-03-2009, 04:52 AM
I'm not very clear here what you want. Do you want to know everything that's going on with the JavaScript file or do you want to be able to output data from a text file or something else? If it's javascript I'd try it in the javascript forum. Outputting data from a textfile can be down with php with this code and with a number of other ways.



<?php
$textfile = "textfilename.txt";
$read = fopen($textfile, 'r');
$rad = fread($read, 99999999999);
echo $rad;
fclose($read);
?>

codeexploiter
02-03-2009, 05:03 AM
They have used ajax for getting the content from the server and put the same in a container. This is a straightforward part as far as the ajax is concerned. Need not be always .txt files but you can even download a .htm/.html file for that matter.

You'll get a fairly good idea about the ajax from the following links:

https://developer.mozilla.org/En/AJAX:Getting_Started
http://www-128.ibm.com/developerworks/web/library/wa-ajaxintro1.html
http://www-128.ibm.com/developerworks/web/library/wa-ajaxintro2/