Kirby “a text based CMS”
I’ve been playing with Kirby over the last couple of weeks, and am really quite impressed so far. The whole idea is based around a flat directory structure within the Kirby folder structure with no database (just text files).
This offers advantages in terms of weight of CMS (much lighter than wordpress) and ease of backups etc – backing up the site means you have everything, so no need for a db backup as well and it has the added advantage that you don’t need to know how to administer a database.
At Kirby home page getkirby.com along with some sample themes and various extensions etc
Installation is dead easy, simply copy the whole of kirby into your target folder and then run the “index.php” file which tells you what else to do (this is basically just edit the site/config.php file to tell kirby where your site is and whether rewriting is on or not, again all this is described by the install page – I just copied and pasted the stuff from the web page into my config file).
Running from a sub folder is slightly different as you will need to change the .htaccess file to point to the subfolder via the RewriteBase entry; because mine was in a root subfolder I edited the line to be:
And made sure that the config.php file had rewrite set to true (I believe this is a kirby default, but I had to change it on my local version to get it to work in IIS). This all then gets the URL rewriting to work so you get nice friendly URLs.
The content all lives under A folder called content and is split into sub directories all named NN-text, so for instance an About Us folder might have in it:
The sub folders prefixed with digits then become sub-pages to the About Us page; the “about.txt” file is the content of the about us page (written in “kirby text” which is a mixture of flat text and HTML etc – still learning that).
Folders that aren’t prefixed with digits become hidden folders, and can be used for other assets etc. These would need to then be defined in your templates.
- css # css used throughout site, linked via “header.php” snippet
- images # images like site logo, stuff that goes on the header/footer etc
Snippets are pieces of PHP that you use for whatever, the default kirby theme ships with a couple of snippets for the header & footer of each page (header.php, footer.php) these are then used in whatever page theme (template) you wish to develop. Snippets live in a folder called snippets under the site folder site/snippets
For the stuff I’ve been playing with I rewrote the header & footer snippets and then added some additional ones of my own namely:
footer.php # amended version of page footer snippet
header.php # amended version of page header snippet
I scrapped their menu & submenu snippets, because I wanted to have a drop down style menu and their versions didn’t do that so I wrote my own and called it:
I then also wrote some library routines to do things like read all the image files in a folder etc (using the kirby classes etc) and put that in a snippet called:
I also included the standard kirby breadcrumb snippet although I haven’t used it yet.
This is where you put all the snippets together to create a web page. This is probably where the flexibility of kirby comes in, for any site you can easily define multiple templates (in fact each page could easily have a different template).
The default template is called “default.php” and is used whenever there is no specific template for that page, the other templates can be named whatever you want and any page that you want to use that template needs to have a text file called:
So for instance I wanted a profile style template (basically it had text on the left and 250px images on the right picked up automatically from the folder) so I created a profile template for that, and then in the folder the web page content was in a file called profile.txt
I wanted my own gallery, so wrote a gallery template (called gallery.php) and in any folder where I want a gallery I just have a text file called gallery.txt – it all makes sense once you start using it. The templates that I’ve currently got are:
default.php # default page layout
home.php # my home page template (pick up first visible page)
Like snippets, the templates folder lives under the site folder site/templates
On the Kirby website you can view (and download) a few demos including a couple of blog themes, the “Slacky” theme is a good one to download as you can look at the code used in their templates to get a good idea of how the thing works.
The site documentation is pretty good and there is a really helpful cheat sheet for kirby functionality (again available from the kirby site) etc. There is also an extensions library which includes stuff like RSS feeds, twitter etc – but haven’t used any of these yet.
MY OWN VERSION/DEMO SITE
I have written a
demo live website using kirby, the URL is www.cybernet-computing.com/customers/kirby-cms-diakonia www.diakonialtd.co.uk so if you want to see it in action have a look there.
If anyone wants a copy of the site, including the code that I’ve tailored, simply comment on this post with an email address and I will send you a link to a ZIP version and then you can pull it apart for yourself.
* I have added quite a lot of comments to my code and templates so hopefully it will make sense *
Finally kirby also offers a CMS admin/maintenance panel which allows users to edit content, upload images etc and the download to that plus install instructions are also available from the kirby site. I’ve only just started to use this but it seems to work ok.
Have a play its a simple, very flexible, CMS and as more people use it, it will only get better; download the demos and just try it (free to try,
£30 €30 to buy).