loading...
Cover image for Couch CMS and the lazy developer

Couch CMS and the lazy developer

antoinette0x53 profile image Antoinette Maria ・5 min read

I do not claim to be a developer, not a good one at least. In fact, I think it would almost insult other developers to call myself one. My only in-depth development experience, aside from writing some smaller tools for work, is as web developer for a start up in college. I worked with Wordpress (written in PHP) and later with Magento and coding with Liquid. I was okay with it but it taught me how tedious working with a CMS can be. Now, I run Reboot Iowa, a non-profit I founded to teach basic computer programming concepts and encourage technical literacy. We designed and built our own website and it looks great (with the exception of a few edits that need to happen on the Donate page, hey...I'm honest about it). The downside is that it is completely static which is not helpful for loading information about upcoming workshops and events dynamically. It's also a pain to update anything, which happens pretty often when you're a budding organization of any kind.

Enter Couch CMS

I spent a few days Googling some solutions for a lightweight CMS. I really didn't want to have to write a Wordpress theme or start all over with a new website while integrating a CMS. And it isn't because I don't think I can do it, but I'm pretty lazy. As I said before, I don't consider myself a developer and so it takes me longer than necessary to figure out everything and I just don't want to spend the time. Enter Couch CMS, a CMS for lazy people like me. Easy to set up and use and even comes with an admin panel. Prayers answered. Now, don't get me wrong. I can see how this tool would be totally useful for non-technical people with a need and being non-technical doesn't make them lazy. I'm calling myself lazy because I have the technical skill and knowledge to master a more robust CMS or even use a framework to build my own and simply choose not to.

I used MAMP to set up a local dev environment on my laptop to test out Couch. Couch CMS is written in PHP, a requirement I had for any solution I ended up using because it's the web language I'm most comfortable with. PHP was the first web language I learned, so it's close to second nature now.

I really liked that I could easily plug in dynamics pieces to a static site. All I had to do was require a file from the Couch directory (couch.php) and invoke at the end of the file. I eventually used it to easily update the bios for myself and my board members and to update various fields such as our 'About Us', 'Vision and Mission', and various other texts that might change in the future. My favorite part was being able to have upcoming events appear on the site and disappear after the date of the event passed. Now Couch is running on our production Reboot Iowa website and it's working out well so far. I still need to add in the necessary code to make our Announcements and News dynamic, but..well... I'm lazy remember?

A Little Taste

Here's a sample of how I added a dynamic events section to the homepage of Reboot Iowa's website.

I began by defining a template for an event in a file called events.php. With this template, an event object appears in the admin panel.

// events.php
<?php require_once( 'couch/cms.php' ); ?> 
<cms:template title='Event' clonable='1' > 
    <cms:editable name='event_description' type='richtext' />
    <cms:editable name='event_image'
        crop='1'
        width='610'
        height='150'
        type='image'
    />
    <cms:editable name='location' label='Location' type='text' />
    <cms:editable name="event_link" label='Event Sign Up Link' type='text'/>

    <cms:editable name="start_time" label="Time From (24 Hrs)"
      opt_values=' Unspecified |
                  00:00 | 00:30 | 01:00 | 01:30 | 02:00 | 02:30 | 03:00 | 03:30 |
                  04:00 | 04:30 | 05:00 | 05:30 | 06:00 | 06:30 | 07:00 | 07:30 |
                  08:00 | 08:30 | 09:00 | 09:30 | 10:00 | 10:30 | 11:00 | 11:30 |
                  12:00 | 12:30 | 13:00 | 13:30 | 14:00 | 14:30 | 15:00 | 15:30 |
                  16:00 | 16:30 | 17:00 | 17:30 | 18:00 | 18:30 | 19:00 | 19:30 |
                  20:00 | 20:30 | 21:00 | 21:30 | 22:00 | 22:30 | 23:00 | 23:30 |'
      type='dropdown'
    />

    <cms:editable name="end_time" label="Time Until (24 Hrs)"
      opt_values=' Unspecified |
                  00:00 | 00:30 | 01:00 | 01:30 | 02:00 | 02:30 | 03:00 | 03:30 |
                  04:00 | 04:30 | 05:00 | 05:30 | 06:00 | 06:30 | 07:00 | 07:30 |
                  08:00 | 08:30 | 09:00 | 09:30 | 10:00 | 10:30 | 11:00 | 11:30 |
                  12:00 | 12:30 | 13:00 | 13:30 | 14:00 | 14:30 | 15:00 | 15:30 |
                  16:00 | 16:30 | 17:00 | 17:30 | 18:00 | 18:30 | 19:00 | 19:30 |
                  20:00 | 20:30 | 21:00 | 21:30 | 22:00 | 22:30 | 23:00 | 23:30 |'
      type='dropdown'
    />

    <cms:editable name='end_date'
        label='Event End Date (if multi-days event)'
        desc='Enter date in yyyy-mm-dd format e.g. 2010-12-31'
        type='text'
        validator='regex=/(?:19|20)\d\d-(?:0[1-9]|1[012])-(?:0[1-9]|[12][0-9]|3[01])/'
        separator='#'
        validator_msg='regex=Incorrect date format'
    />
</cms:template>
<?php $title="Event"; include('header.php'); ?>
<div class="row" >
    <div class="col-sm-12" style="margin-top:35px;">
        <h2 style="margin-left:10px;">Upcoming Events</h2>
        <div class="row">

        </div><hr>
        <div class="row">

        </div>
    </div>
</div>
<?php include('footer.php'); ?>
<?php COUCH::invoke(); ?>

After creating the template and creating some events, I added the necessarily code to the index file to display information about upcoming events.

// index.php
...
...
...
<h2 style="margin-left:10px;">Announcements and Upcoming Events</h2>
        <div class="row">
            <div class="col-sm-3">
                <p class="lead section-lead"><i class="fa fa-calendar fa-2x" aria-hidden="true" style="padding:10px;"></i> <strong>Events </strong></p>
            </div>
            <div class="col-sm-9">
                <cms:set today="<cms:date format='Y-m-d' />" />
                <cms:pages masterpage='events.php' orderyby='end_date' order='asc'>
                <cms:if today lt end_date>
                  <p class="lead section-lead" style="/*margin-left:10px;*/"><cms:show k_page_title /> | <cms:date end_date format='F j' /> </p>

                  <p style="margin-left:10px;">
                    <cms:show event_description />

                      Time: <cms:date start_time format='g a' />-<cms:date end_time format='g a'/></br>
                      Location: <cms:show location />
                      <cms:if event_link !='Unspecified'>
                        <br><a target="_blank" href="<cms:show event_link />">Sign up Here</a>
                      </cms:if>
                  </p>
                </cms:if>
                </cms:pages>
            </div>
...
...
...

You'll notice I set a variable today, done by using the cms:set tag, to compare the event date with the current date in order to determine which events to show.

                <cms:set today="<cms:date format='Y-m-d' />" />
                <cms:pages masterpage='events.php' orderyby='end_date' order='asc'>
                <cms:if today lt end_date>

The many tags, such as cms:set and cms:if, allow me a small range of flexibility when working with the Couch to display information that I really appreciate.

Setup documentation can be found here. In short, all you do is unzip a folder and place it in a directory. After updating the config file with the credentials for your SQL database, you navigate to the admin panel, complete installation, and you're good to go. I won't get into all of the details, but if you'd like to know more about CouchCMS, they have really good documentation. I used to documentation as a guide to figure out everything I needed.

I'm more curious to know about other lightweight CMS's you guys have heard about or tricks you've picked up when running a dynamic site to make it a little easier to use. If you end up trying out Couch, let me know what your think.

Discussion

pic
Editor guide
Collapse
ryanhaber profile image
Ryan Haber

I've started working with ghost lately. Lightweight and build on nodejs. I'm more comfortable with js than php so that is a plus for me. Right now, I'm hosting via ghost.io, which isn't cheap, but isn't deadly expensive, either. I'm hosting because I wanted to get up and running on the spot. They promise that all your data is yours to keep, which is good for when I want to migrate to my own hosting solution.

Collapse
antoinette0x53 profile image
Antoinette Maria Author

I use Ghost (I'm assuming this is the same platform) to host my personal blog. I didn't know about ghost.io though, I'll have to check that out. I host all of my sites with Digital Ocean droplets for $5/mo each.

Collapse
ryanhaber profile image
Ryan Haber

Digitial Ocean?! I'd heard of them but then forgotten about it. That's really good news for when it's time for me to migrate.

Thread Thread
antoinette0x53 profile image
Antoinette Maria Author

Yeah! My background is in system admin stuff so setting up my own web server and having the flexibility and freedom to do what I needed to do without fumbling around cPanel is great for me. I also used Let's Encrypt for my SSL certificate because I like the certbot command line utility to install and update my certs.

Collapse
azazqadir profile image
Muhammad Azaz Qadir

I personally prefer CouchCMS for small websites or blogs. It is lightweight and has good functionality, unlike WordPress which could get bloated. I am currently testing a large magazine site on Couch on my PHP server host. There are some functionalities that I require, for example adding a popup that I had to do manually. Whereas, in WordPress there is a plugin for it. So, Couch is good for small sites, but for big sites it could be a lot of work for you.

Collapse
tomarnst profile image
Tomarnst

"I have the technical skill and knowledge to master a more robust CMS or even use a framework to build my own and simply choose not to."

Regarding this ... I'm not sure what you mean... but in my experience when you're using CouchCMS in most cases you don't need a framework or a more robust CMS. It's quite easy expand it with your own code.

Collapse
ryanhaber profile image
Ryan Haber

Very nice so far, by the way, your website, that is

Collapse
antoinette0x53 profile image
Antoinette Maria Author

Thank you! There's still so much more work to be done around the design and functionality but I'm proud of what we have so far :)