Appendix E. Using Koha as a Content Management System (CMS)

Table of Contents

1. Setup
1.1. Troubleshooting
1.2. Bonus Points
2. Usage
2.1. Adding Pages
2.2. Viewing your page
2.3. Example
2.4. Live Examples

1. Setup

These are instructions for taking a default install of Koha 3.4 or later and allowing it to function as a little content management system. This will allow a library to publish an arbitrary number of pages based on a template. This example uses the template for the main opac page, but you could just as well use any template you wish with a bit more editing. This may be appropriate if you have a small library, want to allow librarians to easily add pages, and do not want to support a complete CMS.

  • Copy /usr/share/koha/opac/cgi-bin/opac/ to /usr/share/koha/opac/cgi-bin/opac/ (in the same directory)

  • Edit in an editor

  • At approximately line 36 change this code:

    template_name  => "",
  • To this code:

    template_name  => "", 
  • At approximately line 54 after this code:

               koha_news       => $all_koha_news, 
               koha_news_count => $koha_news_count
  • Add these lines:

            my $page = "page_" . $cgi->param('p');            # go for "p" value in URL and do the concatenation
            my $preference = C4::Context->preference($page);  # Go for preference  
            $template->{VARS}->{'page_test'} = $preference    # pass variable to template
  • Note file must have Webserver user execution permissions, you can use chmod command if you are actually logged in as such user:

            $chmod 711
  • Copy /usr/share/koha/opac/htdocs/opac-tmpl/prog/en/modules/ to /usr/share/koha/opac/htdocs/opac-tmpl/prog/en/modules/

  • Edit /usr/share/koha/opac/htdocs/opac-tmpl/prog/en/modules/

  • At approximately line 38, change this:

     [% IF ( OpacMainUserBlock ) %]<div id="opacmainuserblock" class="container">[% OpacMainUserBlock %]</div>[% END %]

    To this:

     [% IF ( page_test ) %]<div id="opacmainuserblock" class="container">[% page_test %]</div>[% END %]
  • In the browser go to Home > Administration > System Preferences > Local Use and add a New Preference called "page_test"

  • Fill it out as so

    • Explanation: test page for pages tiny cms

    • Variable: page_test

    • Value: Lorem ipsum

    • Click the TextArea link (or enter "TextArea" into the input field below it)

    • variable options (last field): 80|50

  • In a browser go to http://youraddress/cgi-bin/koha/ The page should come up with the words "Lorem ipsum" in the main content area of the page. (replace "youraddress" with localhost,, or your domain name depending on how you have Apache set up.)

  • To add more pages simply create a system preference where the title begins with "page_" followed by any arbitrary letters. You can add any markup you want as the value of the field. Reference the new page by changing the value of the "p" parameter in the URL.

To learn more visit the Koha wiki page on this topic:

1.1. Troubleshooting

If you have problems check file permissions on and pages.tmpl. They should have the same user and group as other Koha files like

1.2. Bonus Points

Instead of using the address http://youraddress/cgi-bin/koha/ you can shorten it to http://youraddress/ Just open up /etc/koha/koha-httpd.conf and add the follow at about line 13:

ScriptAlias / "/usr/share/koha/opac/cgi-bin/opac/" 

Then restart Apache.