Tutorial Series

The following  posts will show the steps I took to build a flat-file Content Management System for blogging and portfolios. 




Build a Flat-File CMS - Part 1

2017-12-13

VIew LilaWorks flat-file Content Management System Demonstration

If you are curious as to why I decided to do this, when there are so many CMS frameworks already available, you can read about it here.

Warning:  This is not very complicated.   The only code used is basic HTML, CSS and PHP.  The only package I used was a free version of CKEditor.

Who is this Product For?

Most of the popular frameworks that I am familiar with, such as WordPress, Squarespace and Wix, provide exhaustive design capabilities.   Lots of extra code is required so that the person customizing and configuring the website can avoid ever encountering code.  

This makes sense when the designer and user are the same person.   However, in my experience, a designer/developer (like me) is usually asked to get a new website ready before the customer can use it.  

Since the customer always has unique requirements, the first thing I must do is choose a 'theme' that will work now and in the future.   Some frameworks make it difficult to change a theme once it is in place.   Others provide a mind-boggling myriad of themes.  In desperation it's tempting to pick a giant 'do-it-all' theme, the equivalent of taking an ocean liner across a pond.

Since there is so much code involved it's difficult and time consuming to figure out where and what can be changed.    I feel like one of those little birds cleaning a shark's teeth - I have to be very careful of the huge monster I am interacting with. 

To paraphrase Andrei Sorin ("Software and Mind"), lots of extra code is required for the purpose of avoiding coding. 

LilaWorks was created for people like myself who have the responsibility of customizing and maintaining websites.   At present, the design tasks can  be accomplished with a little knowledge of HTML, CSS and simple PHP.   The non-coding user is limited to a very few options - adding and editing posts and pages, managing comments, uploading images and using categories.  

The LilaWorks basic functions are performed in small modules with really obvious names like 'show-latest-posts'.   They are small and comprehensible so It's easy to mix and match and rearrange them on pages.

If the user would like their blog post snippets for the category 'cat recipes' on the bottom of the sidebar, but then they decide that should be a menu item, all you need to do is add an 'includes' to the module that builds that particular page and a line of code in the header module for the menu item.

The great thing about PHP is that it's written in plain English.   How nice to see a statement like 'If (file_exists ($thisfile))" - I know exactly what this means.   Go PHP!!

Ok, let's get started!

Requirements

In order to manage a collection of posts, a blogging engine should:

  • provide an administrative area for authorized users and a login screen
  • provide a way for the user to create and edit posts,  assign categories, featured images and choose a post status
  • provide a variety of ways for post archives to be displayed
  • provide a way to upload images
  • allow readers to comment on posts
  • allow  owner to flag comments as 'approved' or 'unnapproved' for display
  • provide choice of page layouts, including a contact page and sidebar content
  • allow owner to manage content blocks on pages other than posts
  • provide post version backups

There should also be a control panel displaying the website content and user options such as adding posts or images.  

Organization

My strategy was to use four types of files:

1) Data files such as posts, content blocks and images

2) Design files that create the theme or skin: style, header and footer

3) Layout files that organize the data on the page: ex: blog-single, blog-series

4) Program files – php programs that manipulate the Data files and insert them into the Layout files, modified by the Design files.

lilaworks files

...stay tuned for Part 2 - Data Files ...

Category: tutorials