Need Advise About Class/File Structure
Posted: Fri Dec 16, 2005 11:37 pm
The Problem
I've just started work on a volunteer maintained website that has started to show it's age. It's PHP enabled, but PHP is baredly used. Except for a very basic head/footer, all pages are pretty much static.
The most common maintenance we do is to add pages to large archives of similar pages. For a concrete example, we have a NewsStories.php page that contains a master list of all news stories. From here we have a ton of individual story pages in HTML. The structure of the pages has evolved over time so the older ones don't match the newest ones.
Some Solutions
At first I started converting all of the individual stories into 'bare content' (with nothing more than "<p>" statements). Then built a NewsStory.php page that loads the proper content via an HTML parameter (I would call these CGI parameters... but this is PHP).
Then I realized that the title and picture for each story had to be shown on the index page, so the content of each story would be spread across the 'raw content' pages, and the index page. What's more the pieces of data on the index page would have to passed to the NewsStory.php page through HTML parameters.
So I created a NewStory class, and had each story stored as an object. The only drawback here is that ALL story classes need to be built before the index page can be. This seems like an awful lot of overhead.
....
So what should I do?
I've just started work on a volunteer maintained website that has started to show it's age. It's PHP enabled, but PHP is baredly used. Except for a very basic head/footer, all pages are pretty much static.
The most common maintenance we do is to add pages to large archives of similar pages. For a concrete example, we have a NewsStories.php page that contains a master list of all news stories. From here we have a ton of individual story pages in HTML. The structure of the pages has evolved over time so the older ones don't match the newest ones.
Some Solutions
At first I started converting all of the individual stories into 'bare content' (with nothing more than "<p>" statements). Then built a NewsStory.php page that loads the proper content via an HTML parameter (I would call these CGI parameters... but this is PHP).
Then I realized that the title and picture for each story had to be shown on the index page, so the content of each story would be spread across the 'raw content' pages, and the index page. What's more the pieces of data on the index page would have to passed to the NewsStory.php page through HTML parameters.
So I created a NewStory class, and had each story stored as an object. The only drawback here is that ALL story classes need to be built before the index page can be. This seems like an awful lot of overhead.
....
So what should I do?