Question:
HII need to update two pages on my website easily , basically one displays links to daily articles i wright:?
jam
2007-07-08 14:29:37 UTC
Hi

I need to update two webpages daily automatically, one page will has links to daily articles i publish.

The second page has text, basically daily news.

I want to update them so that they take information to display on these two html pages from two text files that i will update daily.

Is it possible? is there an exmaple, i know of the write command in javascript, but how do i automate the files from picking text from another text document isntead of having to update them manually.

At the moment i use manual update of html pages, it takes me ages. I dont have any tools. just notepad for the whole site, i sue, html, and css sheets, for menus etc.

Thanks in advance
Three answers:
tpennetta
2007-07-08 14:48:02 UTC
Hello,



If your server supports PHP which most hosts do nowadays, you can try something like this (I will explain each line and hopefully it will make some sense):




//read and print File

if(file_exists("myfile.txt")) {

//Store string of contents of file

$output = file_get_contents("list.txt");

//Print the contents of the file

echo nl2br($output);



}

?>



If you insert this code where you want the text output this would work and all you have to do is change "myfile" to your text file.



This works by:

1.) Check if the text file exists (if so continue, you can add an else to handle error)

2.) Store the text file into a variable called output

3.) echo means print this (in this case output)



That should do the trick.



EDIT:



Also I would like to point out this is a better way than Javascript because a LOT of people disable Javascript in their browsers for security purposes which would not allow your whole site to have any text. So this would definitely be the way to go



END EDIT



Best of Luck! Hope this Helps!
anonymous
2007-07-08 16:42:37 UTC
You could use XML Data Islands but only Microsoft (internet explorer) supports them at the moment.





Although Mozilla does sort-of support them.
anonymous
2016-04-01 07:49:26 UTC
Veoh, a much better version of youtube with perfect picture quality and with the ability to download content and watch it in full screen.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...