Page 1 of 1

get content of folder..

Posted: Tue Mar 04, 2008 3:21 am
by linux4me
hi all :)

I have 3 textfiles (1.text, 2.text. 3.text), in a folder called news, and i want to show the contents of these files, like "teasers" in a div with a "read more"-link.. and when clicked it shall show the chosen file's content in a other div on the same site..

I have the HTMl and the CSS done, but i need help with the PHP-code
How shall i code the PHP to make this happen?

it would be sweet if someone of you could code this for me or give me some hints ;)

Best regards :)

Re: get content of folder..

Posted: Tue Mar 04, 2008 9:56 am
by pickle
Us writing the code for you is never going to happen unless you put some effort into it yourself. Freebies aren't looked upon kindly here.

That said, I can give you some direction. You're going to have to open each of the text files, read the contents into a string, and truncate the string to a given length.

Re: get content of folder..

Posted: Tue Mar 04, 2008 10:24 am
by Zoxive
pickle wrote:That said, I can give you some direction. You're going to have to open each of the text files, read the contents into a string, and truncate the string to a given length.
file_get_contents();
nl2br();
substr(); &| wordwrap();
strlen();

Re: get content of folder..

Posted: Tue Mar 04, 2008 12:19 pm
by linux4me
Thank's guy's :)