content management theory
Posted: Tue Aug 07, 2007 5:42 pm
-- Background --
I've got this basic content management system that has News & Events. The only difference between the 2 is that Events has a start & end date. There is a News table in the database and an Events table.
On the public side both sections are in their own single .php file that generates multiple possible pages:
search form (?cmd=search)
search results
view an item (?cmd=view)
view a list of most recent items (?cmd=start)
Any News or Calendar entry can have an infinite number of images, audio files, video files, & documents assigned to it for display on the public side.
News and Calendar entries can have any number of News Categories or Calendar Categories assigned to them. These categories can have 1 level of subcategories.
Over the last year, multiple clients have requested additional sections to their site that once again vary only slightly (if at all) from the basic News/Events format. For example, the Download Library section is NO different from the News section except that it uses "download categories" instead of "news categories" and on the public side we just don't show anything except the list of downloadable files. Same way with "galleries".
As a result there have been times where I've just used a sub-category of the News Categories to impliment the Download Library section on the public side of a site.
This resulted in lots of copy/pasting of the same code on both the admin and display sides of many sites.
Usually a client just wants a new section that is literally no different from an existing section so we can just throw a switch in an existing include file to accommodate the new section but sometimes they want a new section that would require removing one or 2 unused fields or adding at most 1 additional field and so we just copy/paste an existing include and rip out the unused bits, find/replace the 'name' of the 'thing' (News becomes Reviews), duplicate the news table, rename it to reviews, add a new category section for review categories, done.
And of course if I find a flaw in one file I've then got to go searching through tons of other files to fix the same bug over and over.
And when a client wants to greatly expand on an area that was initially hacked out of an include used for another area instead of being it's own copy that means a lot of writing from scratch and exporting 'download library' data from the News table to then import into the new proper custom written Download Library.
There's also this other thing called Departments which is kind of its own section like New/Events but at the same time different Departments can be used to categorize entries in all other sections. So a news item can be in the "Press Releases->Charity" News Category/sub-category and also in the "Philanthropy" category and also in the "River City Office" Department and also in the "Northern Region -> Public Relations" Department (multiple categories and multiple departments with possible Subs of each)
So there may be a public display of departments that follows the mold of a news article: Headline(name), descriptive text(article), photos of department-members (photo gallery), introductory video for new employees (audio/video gallery), job application forms (pdf download library) etc... and then there'll be news articles in the news section relative to that department and I'm sure somewhere in the future some client is going to want departments that are within larger departments that are within larger departments etc... and I have no clue how to even begin to think about all that.
-- Examples --
http://tinyurl.com/36fpd8 [news, events, 'diaries', 'races', 'galleries']
http://tinyurl.com/2t6zuh [news, events, 'parks']
http://tinyurl.com/2k4gdf ['downloads']
http://tinyurl.com/2jmtvv [news, events, 'issues', 'multimedia', 'galleries', 'blogs']
-- Questions __
Is it a bad idea to use a single .php file to do that functionaly for displaying on the public side?
Would I be better off with a page that just searches any section, just displays search results for any section etc?
What's a good technique for implimenting an infinite number of categories->sub-categories->SubSub-categories->etc...
Any suggestions for rebuilding my system using Objects? (I've used classes to build a pretty ok pagination class and a few other basic things but I've still never needed to use inheritance or any other advanced featured of OOP)
Do you prefer to name youd database tables in the singular or plural?
and 20 other questions I forgot while remembering all the background stuff I wanted to convey at the beginning
I've got this basic content management system that has News & Events. The only difference between the 2 is that Events has a start & end date. There is a News table in the database and an Events table.
On the public side both sections are in their own single .php file that generates multiple possible pages:
search form (?cmd=search)
search results
view an item (?cmd=view)
view a list of most recent items (?cmd=start)
Any News or Calendar entry can have an infinite number of images, audio files, video files, & documents assigned to it for display on the public side.
News and Calendar entries can have any number of News Categories or Calendar Categories assigned to them. These categories can have 1 level of subcategories.
Over the last year, multiple clients have requested additional sections to their site that once again vary only slightly (if at all) from the basic News/Events format. For example, the Download Library section is NO different from the News section except that it uses "download categories" instead of "news categories" and on the public side we just don't show anything except the list of downloadable files. Same way with "galleries".
As a result there have been times where I've just used a sub-category of the News Categories to impliment the Download Library section on the public side of a site.
This resulted in lots of copy/pasting of the same code on both the admin and display sides of many sites.
Usually a client just wants a new section that is literally no different from an existing section so we can just throw a switch in an existing include file to accommodate the new section but sometimes they want a new section that would require removing one or 2 unused fields or adding at most 1 additional field and so we just copy/paste an existing include and rip out the unused bits, find/replace the 'name' of the 'thing' (News becomes Reviews), duplicate the news table, rename it to reviews, add a new category section for review categories, done.
And of course if I find a flaw in one file I've then got to go searching through tons of other files to fix the same bug over and over.
And when a client wants to greatly expand on an area that was initially hacked out of an include used for another area instead of being it's own copy that means a lot of writing from scratch and exporting 'download library' data from the News table to then import into the new proper custom written Download Library.
There's also this other thing called Departments which is kind of its own section like New/Events but at the same time different Departments can be used to categorize entries in all other sections. So a news item can be in the "Press Releases->Charity" News Category/sub-category and also in the "Philanthropy" category and also in the "River City Office" Department and also in the "Northern Region -> Public Relations" Department (multiple categories and multiple departments with possible Subs of each)
So there may be a public display of departments that follows the mold of a news article: Headline(name), descriptive text(article), photos of department-members (photo gallery), introductory video for new employees (audio/video gallery), job application forms (pdf download library) etc... and then there'll be news articles in the news section relative to that department and I'm sure somewhere in the future some client is going to want departments that are within larger departments that are within larger departments etc... and I have no clue how to even begin to think about all that.
-- Examples --
http://tinyurl.com/36fpd8 [news, events, 'diaries', 'races', 'galleries']
http://tinyurl.com/2t6zuh [news, events, 'parks']
http://tinyurl.com/2k4gdf ['downloads']
http://tinyurl.com/2jmtvv [news, events, 'issues', 'multimedia', 'galleries', 'blogs']
-- Questions __
Is it a bad idea to use a single .php file to do that functionaly for displaying on the public side?
Would I be better off with a page that just searches any section, just displays search results for any section etc?
What's a good technique for implimenting an infinite number of categories->sub-categories->SubSub-categories->etc...
Any suggestions for rebuilding my system using Objects? (I've used classes to build a pretty ok pagination class and a few other basic things but I've still never needed to use inheritance or any other advanced featured of OOP)
Do you prefer to name youd database tables in the singular or plural?
and 20 other questions I forgot while remembering all the background stuff I wanted to convey at the beginning