Simple CMS System
Each time I build a new website I simplify the page code so it is easier to make site-wide changes later on. The most basic step is to separate the styles from the content with an external style sheet.
To control positioning, sections of the page are then wrapped in DIV tags which reference the sytle sheet data. This eliminates table code.
Then I have common code in an external php file that gets inserted on every page such as the footer and logo. This results in neat and tidy page code that is easy to change.
But, each page still has duplicate information on it i.e. the layout of the functional blocks. So if I wanted to add a new block such as another navigation bar then I would need to change every page on the site.
So, what I am planning to do from now on is to have templates that define what goes on each page. Then each page will only differ by the title, an id number and the template type it is using. The id number is to use with a database to select dynamic content relevant to that particular page such as comments.
Now it would be easy to transform the whole site by editing the templates and css file i.e. we have implemented a theme system.
So this is my idea for a simple content management system. Unlike the CMS scripts that are available, I will edit the content and theme offline and upload any changes. Here’s why I like to do it like this instead of using a CMS script:
- I like to use a web editor for this task
- I want to understand how everything works in the code
- I like to hand code with neat looking code layout
- I want my site to be optimized for search engines
- I want a local copy of my site and all the content
- I’m only making a simple content site
The point about SEO is an important one since most CMS scripts struggle to create page urls that look natural, containing keywords. The reason is that it is easier to use numbers to represent pages where these pages are dynamically generated. For example, there may be one page containing a script that generates all the pages of a site. So urls may look like: page.php?number=12 To make the url into a search engine friendly one, special features of the web server need to be used which may not be available to many people.
As promised, it’s now launched!