Log in

View Full Version : PHP News Scripts & Random Include



CMcMahon
01 Feb 2006, 01:35 PM
Basically, I have somewhere between forty and fifty newsposts on my site right now, all on the same page. I created a /news/ directory and put each individual post into a separate PHP file (organized by date, ex: 060128.php for the January 28, 2006 post), and set it up for the time being so that only the five most recent ones are on the main page (via "<?php include..."); now, this works fine, at least for the time being. What I'm looking for, though, is some sort of script that will automatically put the five most recent posts on the main page, but allow all of the others to be accessed via an archive that automatically updates when I add a new post. I know that I can do it manually (and that it wouldn't take much time, honestly), but I'd rather have something do it for me to save the hassle of updating multiple pages, rather than just the individual newsposts. Does anyone know of anything that'll do this?

Also, what would be the code to randomly select a file out of a folders (ex: /sidebars/ with several different sidebar formats and styles to choose from), and add them into the page via "<php? include..."? Basically, I have one sidebar/menu currently, but I want to eventually set it up so that every time a page is loaded, the format stays the same (the sidebar is contained in a table column, in Imageready slices), but the actual content of the sidebar changes (ie: a totally different set of sliced images).

edit: On a sidenote, the extent of my experience with PHP is phpBB (about three years ago) and a lot of use of "<?php include..." (it really is pretty damn useful) and not much else.