RasielD Posted May 18, 2009 Share Posted May 18, 2009 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. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 18, 2009 Share Posted May 18, 2009 Use a database. It'll be way easier than creating txt files. Quote Link to comment Share on other sites More sharing options...
RasielD Posted May 19, 2009 Author Share Posted May 19, 2009 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. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 19, 2009 Share Posted May 19, 2009 How would you know it would be a whole lot more code? Have you tried it both ways? Quote Link to comment Share on other sites More sharing options...
Hybride Posted May 19, 2009 Share Posted May 19, 2009 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. Quote Link to comment Share on other sites More sharing options...
RasielD Posted May 19, 2009 Author Share Posted May 19, 2009 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.