Hi please help me,I am kind of new at php.

This is what i have to do please ,provide me with a code if some one can

1)I have files named like 10.txt,9.txt,7.txt etc..//only text files
2)higher the number of the file hisger the priority
3)i just want to use php to read from each file and display it on screen eg... say i am reading from 10.txt then i will display the text of 10.txt on screen say for 100 seconds....
then this fades away and i display the text of 9.tx for 90 seconds ...
and so on and after the last file is read the process repeats again.....

the code to do so from ajax and javascript is very dirty and i can not understand much
Please provide a php solution to this??

Recommended Answers

All 6 Replies

This is not possible with PHP without using some other language as well, PHP is a server-side scripting language and does not control how the text is displayed, this is dealt with by the HTML/CSS/javascript.

PHP can open the files and display the contents of them, but to move to the next file without reloading the page will require AJAX or at least some form of JavaScript

Yeah, you will need something like javascript for this. Ajax techniques are probably best suited for this.

thanks for the reply!!

any idea from where should i begin!!!!!

To get a list of files in a directory, look into the opendir() readdir() and closedir() functions in PHP, to get the contents of the files, look at the fopen() fread() and fclose() This is the starting point, for assistance in Javascript there is a specific forum on here for that.

thanks for the reply!!

any idea from where should i begin!!!!!

Search for one(there are several free source projects available) tear it apart and see how it works. That's the best way.

thanks man....
i was tryinhg to make the same thing using php by the function s you just described and some html...guess i will try to use javascript or ajax

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.