Jump to content

Near complete noob to php needing some help, Including files from a directory...


RasielD

Recommended Posts

I'm completely new to PHP and, through looking on various sites and other online resources, I came across the <?php include ()?> comand. It has already made the site I'm working on much easier to update, but I am having trouble doing something specific with it.

 

What I need it to do is either (A) include all the .txt files from a directory on one page (news) and only the 5 most recent .txt files (or highest file names, for example, the text files might be from n1.txt, n2.txt, n3.txt, n4.txt all the way up to n10.txt, and it would only show n6.txt through n10.txt on this page or something like that) on the home page or (B) include all the information from one .txt file on one page and only the 5 lowest sections (or highest declared section, for example, the IDs might be from 1-10, and it would only show IDs 6-10 or something like that) on the home page.

 

What this is being used for is news about the site with the most recent on the index and all of it on the news page and I have almost no idea what code I need to put together to make something that would do that.

 

Also, if this method is too complicated of a system, can you suggest a system that might be easier to do for it? I'm trying to make this thing as easy to update and maintain as possible and I really don't know what to do.

I'd rather avoid databases since that goes into a whole lot more code that I really don't know, unless you know of a few good tutorials that I could try to learn this from or script depository and the scripts I'd need to put it together.

 

All I'm looking for is a fairly nice, simple system that will put the 5 most recent news bits up on the home page and will put on another page all the news bits like an archive page.

I'd rather avoid databases since that goes into a whole lot more code that I really don't know, unless you know of a few good tutorials that I could try to learn this from or script depository and the scripts I'd need to put it together.

 

All I'm looking for is a fairly nice, simple system that will put the 5 most recent news bits up on the home page and will put on another page all the news bits like an archive page.

As Ken2k7 mentioned, a database is the best way to go. It's not too difficult to learn, and it will help you a lot later with the updates you want to do. Avoiding it will most likely hinder your process later on.

All I really know is basic Html page code. I've never messed with database coding. I looked up some tutorials on it before and it looked like it required a whole lot of new code that I had never seen before.

 

Can anyone give me a good site with some tutorials for this then?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.