OpenACS Edit This Page Templates

by Nick Carroll

OpenACS docs are written by the named authors, and may be edited by OpenACS documentation staff.

Goals

  • Learn about the OpenACS templating system.

  • Learn about subsites and site-map administration.

Introduction

The OpenACS templating system allows you to give your site a consistent look and feel. It also promotes code maintainability in the presentation layer, by allowing presentation components to be reused across multiple pages. If you need to change the layout for some reason, then you only need to make that change in one location, instead of across many files.

In this problem set you will familiarise yourself with the templating system in openacs. This will be achieved through customising an existing edit-this-page application template.

Before proceeding, it is strongly advised to read the templating documentation on your OpenACS installation (http://localhost:8000/doc/acs-templating). The documentation lists the special tags available for ADP files.

Exercise 1: Create a Subsite

  • Create a subsite called pset3.

  • A subsite is simply a directory or subdirectory mounted at the end of your domain name. This can be done in one of two places:

    • http://localhost:8000/admin/site-map

    • or the subsite admin form on the main site, which is available when you login to your OpenACS installation.

Exercise 2: Checkout and Install edit-this-page (ETP)

  • Checkout ETP from CVS:

    cd ~/openacs/packages
                cvs -d:pserver:anonymous@openacs.org:/cvsroot login
                cvs -d:pserver:anonymous@openacs.org:/cvsroot co edit-this-page
  • Go to the package manager at http://yoursite/acs-admin/apm. And install the new package: edit-this-page.

  • Or use the "Add Application" form available on the Main site.

Change ETP Application

  • Work out how to change the ETP application.

  • Investigate each of the available ETP templates:

    • Default

    • News

    • FAQ

Exercise 4: Create a New ETP Template

  • Browse the files for each of the above ETP templates at:

    cd ~/openacs/packages/edit-this-page/templates
  • Use the article template as the basis of our new col2 template.

    cp article-content.adp col2-content.adp
                cp article-content.tcl col2-content.tcl
                cp article-index.adp col2-index.adp
                cp article-index.tcl col2-index.tcl
  • The template should provide us with the following ETP layout:

    Table 10.1. table showing ETP layout

    Header
    SidebarMain Content Pane

  • The "Main Content" pane should contain the editable content that ETP provides.

  • The "Header" should display the title of the page that you set in ETP.

  • The "Sidebar" should display the extlinks that you add as a content item in ETP.

Exercise 5: Register the col2 Template with ETP

  • Need to register your template with ETP so that it appears in the drop-down menu that you would have seen in Exercise 3.

    cd ~/openacs/packages/edit-this-page/tcl
                emacs etp-custom-init.tcl
  • Use the function etp::define_application to register your template with ETP

    • Uncomment the "asc" definition

    • Set allow_extlinks to true, the rest should be false.

  • Restart your server for the changes to take effect.

Exercise 6: Configure ETP to use the col2 Template

  • Configure your ETP instance at /lab4/index to use the col2 template.

  • Create external links to link to other mounted ETP instances.

  • Check that your external links show up in the sidebar when you view your ETP application using the col2 template.

Who Wrote This and When

This problem set was originally written by Nick Carroll in August 2004 for the University of Sydney Course EBUS5002.

This material is copyright 2004 by Nick Carroll. It may be copied, reused, and modified, provided credit is given to the original author.

($Id: tutorial-etp-templates.html,v 1.12.2.4 2021/09/03 09:15:33 gustafn Exp $)