Hi! I am relatively new to this, and have taken on a project which may turn out to be beyond my capabilities. I am turning to a few forums like this for guidance and hep.
I am trying to create a website that is both 100% valid CSS HTML, and dynamically PHP driven. I have the stylesheet all set up, and have made a few HTML test pages that work fine with it. I then started creating php files to split this all up...
I have 'header.inc' which is the header information for all pages - this remains the same. I also have 'footer.inc' and 'sidebar.inc' which also remain the same for all pages. I then have each page load in the .inc files, as well as one or more txt files. The txt files are the content portions of the pages, that which is different. I was going to use xml files, but these will be edited by complete incompetents, so I thought txt would be best.
These text files have the title of the page(s) they appear in as e first line, comma separated if more than one. As of now, this information is simply ignored; you'll see why I have it later. On the next line there is a section heading. The rest of the file is the contents of that section.
So far, I hope I have it working in the best manner possible - if you know of a way to streamline my coding, I would appreciate advice. (It does seem to work, but better is always . . . better.)
My biggest problem is in a portion of that sidebar include. I want the capability to read all of those text files in the directory, and find out when they were last edited. Then I want to display a list of 'Recent Updates', including the title of the page, the date it was edited, the section heading, and the first 10 or 20 words of the section. The entire bit should be a link to the page it is included on.
As an example of what I have and what I want... I'll use the home page and a news page.
index.php, the home page, loads in the 3 include files for a header, sidebar, and footer. It scans the directory 'content' for text files named home#.txt (where # is 1, 2, 3, etc.). home1.txt contains the following;
Home Page
Welcome!
This paragraph is the text which welcomes new visitors to the website.
It has a few sentences about the website, and a few about the business.
home2.txt has the following;
Home Page
Mission Statement
This lists the mission statement of the company.
And so on. The news page (news.php) loads in the 3 include files for a header, sidebar, and footer. It scans the directory 'content' for text files named news#.txt...displaying as many news items as there are.
Now, let's assume that the last 5 updated text files are home2.txt, news24.txt, news25.txt, news26.txt, and news3.txt. In the sidebar, I was a small section that has a header 'recent updates' and prints out the following;
RECENT UPDATES
Home Page (January 5, 2007)
Mission Statement
This lists the mission statement of the...
News Page (January 6, 2007)
Article 24 Title
This is the contents of news article 24...
News Page (January 6, 2007)
Article 25 Title
This is the contents of news article 25...
News Page (January 6, 2007)
Article 26 Title
This is the contents of news article 26...
News Page (January 8, 2007)
Article 3 Title
This is the contents of news article 3...
And of course, each listing is a link to the appropriate page.
So hopefully I described what I want to happen adequately. I know it is beyond me at the moment, but I don't know how MUCH beyond me it is, if it is even possible. How do I read in the last modified date of the files, and compare them to determine the X most recently edited files? I think with that one bit solved, I can figure out how to make the structure as I want it... I hope!
Thanks!