get content of folder..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
linux4me
Forum Newbie
Posts: 2
Joined: Tue Mar 04, 2008 3:12 am

get content of folder..

Post 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 :)
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: get content of folder..

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: get content of folder..

Post 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();
linux4me
Forum Newbie
Posts: 2
Joined: Tue Mar 04, 2008 3:12 am

Re: get content of folder..

Post by linux4me »

Thank's guy's :)
Post Reply