Originally posted by: Woosta
Originally posted by: Crusty
Originally posted by: Chosonman
Originally posted by: Crusty
<?php
$file = fopen("welcome.txt", "r") or exit("Unable to open file!");
while(!feof($file))
{
echo fgets($file);
}
fclose($file);
?>
Then all thats needed to change the text on the website is to edit welcome.txt.
What happens when he wants to change the text without having to reload the page?
That wasn't part of the question. Nowhere did he say he wants to be able to do this without a page refresh, and given the nature/presentation of the question I have a hard time believing that's what he wants.
The problem is making the maintenance of the website easier for somebody that doesn't know much about web design/development.
It's in the topic title, he wants text to appear when a user's actions trigger the mouseover event on a certain element - either he'd use XHR or an iFrame.
:%s,ajax,,g
Looks to be a simple GET request to a text file stored on the server.
http://76.74.181.101/apache2-default/
Here's a simple page using XHR and some dynamic js. Sorry for the shitty indenting, I was lazy and pasted this in putty/ssh and it handles windows tabs/newlines like shit.
There's a function that handles GET and POST requests for XHR, and then on window load I'm adding an event handler to the mouseover event for the anchor element, when a user hovers over it checks if the division with the content from the text file exists and is hidden, if it exists then its shown, else it creates a new GET request and grabs the text from 'foo.txt' located in the same path (relative link) and puts that inside of a newly created division element via DOM methods.
Edit: Damn, I knew I should've read the whole original post. You want it to be editable by users... if I have some time later this week and if you don't already find out how to, I'll try to update my page.
How should this be editable? Should it just be a textarea? You're going to need to use a server-side script to save the new data whether it's a .txt or using a database.