Create web pages in Koha (Koha as a CMS)

Users can publish pages on Koha OPAC  and OPAC can act as a tiny library web site. I have tried this feature on Koha 3.22.10 version. Very detailed documentation available at Koha Wiki. Here is Koha OPAC with few pages; http://mgucat.mgu.ac.in
A page in OPAC to describe library collection.

Edit Pages.pl file
Open Applications > Accessories > Terminal

sudo su
cd /usr/share/koha/opac/cgi-bin/opac
cp opac-main.pl pages.pl

Open following file,

leafpad /usr/share/koha/opac/cgi-bin/opac/pages.pl

Find following line,

Line 34 (Approximately)

Comment following line by adding #

#template_name  => "opac-main.tmpl",

Add the following line below,

template_name  => "pages.tt",

Next,
Find following piece of code, line 60 (Approximately)

$template->param(
           koha_news       => $all_koha_news,
           koha_news_count => $koha_news_count,
           display_daily_quote => C4::Context->preference('QuoteOfTheDay'),
           daily_quote         => $quote,
           );

Add following piece of code below,

my $page = "page_" . $input->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 pages.tt

Save and close the file.

Change user permission of pages.pl file,

chmod 755 pages.pl

Editing the pages template
Make copy of opac-main.tt and rename it to pages.tt

cd /usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/modules

cp opac-main.tt pages.tt

Open pages.tt file in a text editor;

leafpad /usr/share/koha/opac/htdocs/opac-tmpl/bootstrap/en/modules/pages.tt

Find following pice of code at line 68 (approximately)

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

Replace with following lines,

[% IF ( page_test ) %]<div id="opacmainuserblock">[% page_test %]</div>[% END %]

Save and close the file.

Open following file,

sudo leafpad /etc/koha/apache-shared.conf

Add following line at line 12,

ScriptAlias /pages.pl "/usr/share/koha/opac/cgi-bin/opac/pages.pl"

Save and close the file.

Restart Apache

/etc/init.d/apache2 restart

Create first page
Koha > Administration >  System preferences > Local use < New preference

Create a sample page.
Add more pages by creating new system preference. The page title should begin with "page_" (e.g. page_collection).

Try new page on browser http://127.0.1.1/pages.pl?p=test

You can place links anywhere in Koha.
For exmaple, links on left side of OPAC.

Add following  HTML tag in System Preferences > OPAC > opacnav

<a href="http://127.0.1.1/pages.pl?p=test">Services</a>

The page link will appear in OPAC left navigation space.

Reference
Koha as a CMS

8 comments:

  1. This is excellent feature.. Thank you Ji.

    ReplyDelete
  2. good initiative.congrats

    johny
    college librarian,p k m college of education,madampam,kannur

    ReplyDelete
  3. is this feature possible in koha version 3.16

    ReplyDelete
  4. Thanks for sharing this valuable information..keep posting...

    barcode software

    ReplyDelete
  5. is this feature possible in koha 3.10 version

    ReplyDelete
    Replies
    1. Possible with Koha 3.10. But better to upgrade to latest version.

      Delete