Lime Blast (The virtual home of Web developer Daniel Hollands, the place to be if you're looking for articles and tutorials (and rants) on all aspects of the World Wide Web.)
  • Navigation
  • Home
  • About
  • Portfolio
  • Blog
  • Contact

How to use Couch CMS with Git

Posted: 31st July 2012 at 8:48 pm

Comments: Leave a Comment

After around a year of using WordPress for the majority of the websites I built for Ghost, I was looking for something different.

That isn’t to say that WordPress is bad – it isn’t – it’s just that for some of the projects I was working on, using WordPress was a bit like cracking a walnut with a sledgehammer.

Add to this the fact that the majority of our clients were having trouble understanding the WordPress administration interface (meaning that, more often than not, I ended up populating the content for them), I was looking for something better suited to the type of project I was working on.

Enter CouchCMS

CouchCMS is a lightweight content management system that is designed to work with pretty much any HTML template you wish to throw at it.

Unlike a lot of other CMSs I’ve used, which require that you convert your template into a theme (which, depending on the CMS at hand, can be hard work, not to meantion downright confusing for a beginner), Couch instead gets you to define the editable regions of your template via the addition of some special tags added to your existing markup, which it then uses to build the administration area of the site to your requirements.

But this post isn’t designed as a review of Couch (although if it was, it would probably say something like “two thumbs up”), or even a tutorial on how to use it - rather, the purpose of this post is to explain my plan to use Couch with Git.

Separation of data and logic

Since getting into Git I’ve discovered lots of really useful ways to make my life easier. For example, after following an article on how to Install and manage WordPress with Git, all the WordPress sites that I maintain on a daily basis are version controlled with the minimum of fuss, making it easy for me to update them as and when I need to.

This is achieved via the use of a submodule containing the core WordPress files (and nothing site specific), while the rest of the repository contained the bits specific to the site being built. This is very similar to the concept of the separation of  data and logic.

I wanted the same with Couch, but the default install has at least two folders (uploads, snippets) and one file (config.php) that exist within the main couch folder.

I made a post in the forum about this, and found that the aforementioned folders are easily moved, but without a config.php file in the correct place, Couch would just refuse to work. Although it looks as though the guy who wrote Couch might implement a fix for this himself at some point in the future, I’m impatient, so I made my own solution.

What I did

The solution, when you think about it, is really simple. First I made a copy of the default config.example.php file, renamed it config.php, then moved it into the root directory folder before customising its settings (while not forgetting to set the values for the uploads and snippets folders), then created a new config.php file in the couch folder with the following content:

<?php
$folder = dirname(dirname(__FILE__));
require $folder.'/config.php';

As you can see, this gets the path to the root folder (because relative paths don’t work), then uses it to require the config.php file that has all your settings in it.

Now that the couch folder is standalone, you’re free to do whatever you want with it, such as set it up as a submodule, or simply ignore it from your Git repository.

I’ve tested this with Couch 1.2.5 and 1.3-RC1, and so far as I can see, it works fine with both (although I can’t see any reason why it shouldn’t work with any version of Couch, past or future).

Written by Daniel Hollands

Daniel Hollands is a jack-of-all-trades web developer trying his best to keep up to date with everything the Web has to offer. He keeps this blog in the hope that someone might find what he has to say useful.

Visit his Homepage, follow him on Twitter, Facebook, LinkedIn, and Google+, or hire him for your next project.

This entry was posted in Share the knowledge and tagged CouchCMS, Git, Wordpress. Bookmark the permalink.

Related posts:

  1. Images in responsive WordPress Web sites

    For the past couple of weeks I’ve been learning how to build responsive Web sites, a process that is simple in principle, but complex in practice once you get down to the nitty-gritty. As I want to use this blog as......

  2. CSS Crush

    Although there is a lot of love for CSS preprocessors such as LESS and SASS, both of which seem to work very well, I wanted to take a moment to talk about a slightly different alternative, the PHP-based CSS Crush. Much......

  3. Facebook Timeline Photoshop Template

    Seeing as Facebook’s Timeline feature is making the move to Pages, I figured that now was a good time to share the Facebook Timeline Hack Template that I used to style up my Timeline Page. The download includes a Photoshop......

  4. Deploying a Git repository via FTP

    As any regular reader of this blog will know… *watches as tumble-weed bounces across the void* …one of the main reasons I got a dedicated server was because of Git, and all the wonderful things that it is able to do for......

  5. Running a server is hard work

    I was hoping, when I first had the idea for this post, that it would be a run-through of all the steps I has taken in setting up my dedicated server. It was going to include links to the resources......

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Calendar

July 2012
M T W T F S S
« Jun   Oct »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Categories

  • Credit where credit is due (8)
  • Gaming (2)
  • Just Plain AWESOME!!! (3)
  • News (6)
  • Rants (4)
  • Share the knowledge (6)
  • Tools and Resources (2)

Archives

  • May 2013 (2)
  • April 2013 (1)
  • January 2013 (5)
  • December 2012 (2)
  • November 2012 (2)
  • October 2012 (1)
  • July 2012 (2)
  • June 2012 (3)
  • May 2012 (1)
  • April 2012 (2)
  • March 2012 (4)
  • February 2012 (5)
  • January 2012 (1)

Affiliates

UK Cloud Hosting. Fast, Reliable & Infitely Scalable. TSOHost. eCommerce for Designers - LemonStand

Recent Posts

  • The importance of a good password
  • Once you go Mac, you’ll never go back – but should I?
  • Android game recommendations
  • How to easily create iOS app icons for your website
  • Own the (Guardian and Observer) Weekend!
  • Usability Evaluations within the Web Design industry – please complete my survey
  • Getting started in business as a web developer
  • Launched new profile site – My Name is Daniel
  • Carl Sagan Tribute Series

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 5 other subscribers

RSS

RSS Feed RSS - Posts

RSS Feed RSS - Comments

Tag Cloud

Android Apple Asus Beanstalk Behaviours Bitbucket CakePHP cPanel CSS Debian Dedicated Server Dell EXIM Ghost Design Git GitHub Google Apps Hetzner Humble Bundle Inspiron Duo iOS iPad iPhone iTunes limeBase Mercurial Microsoft PC Photoshop PHP Plugins Propeller Communications Responsive Web Design SASS Siri SPAM SSH Submodules Tegra 3 Quad-core TortoiseHG Transformer Prime Ubuntu Server Windows 7 Windows 8 Wordpress
© 2013 Daniel Hollands.