<% ns_puts [nsv_get mkm_includes mkm_oldContentHeader_inc] %> Next Previous Contents

3. Look and feel

There's quite a bit of information about this on Establishing Style and Supporting Multi-Lingualism at /doc/style.html.

Basically you have four ways of modifying the look and feel of your OpenACS website:

  1. Editing ad_header and ad_footer
  2. Customized ADP tags
  3. Templates
  4. Karl's Dynamic Publishing System
    Not included in OpenACS but available from http://karl.arsdigita.com

3.1 Editing ad_header and ad_footer

Almost all of the tcl pages shipped with OpenACS make calls o ad_header and ad_footer, two procedures defined in tcl/ad-defs.tcl.preload

ad_header returns the initial HTML tags and title to the page, and optionally returns extra stuff for the <head>. This is its usage:

ad_header page_title { extra_stuff_for_document_head "" }

ad_footer stuff an <hr> and a e-mail signature (defaults to system owner) and then it closes the body and html tags. Its usage is:

ad_footer { signatory "" } { suppress_curriculum_bar_p "0" }

For example, you'd call them from an adp page like this:


<%= [ad_header "My First OpenACS Page"] %>
<%= [ad_footer "me@mydomain.com"] %>
 

The "<%=" means "evaluate this and then return as a ns_puts". The above would return a page with the title "My First OpenACS page" and an e-mail signature in the bottom saying "me@mydomain.com".

Ths disadvantages of this approach is that it's very limited and requires restarting AOLserver for changes in the ad-defs file to take effect.

3.2 Customized ADP tags

OpenACS has some utility procedures to help you. One of them is ad_register_styletag (defined in tcl/ad-style.tcl).

With ad_register_styletag you can register a tag can will be available for use under ADP and TCL pages. It will also register documentation for that tag through the proc_doc OpenACS procedure.

Usually what I do is rename the file tcl/photonet-styles.tcl to tcl/myservice-styles.tcl and then edit it. In that file I define some tags like "pagetop", "pagebottom", "pageside". Then I call these tags from ADP pages just like regular HTML tags (e.g. <pagetop></pagetop>). From .tcl pages, you'd call these tags through "ad_style_pagetop" (or [ad_style_pagetop] if you are calling it from inside a ns_write).

ad_register_styletag used the AOLserver API call to ns_register_adptag, which will give you more flexibility on defining your tags (e.g. you can define tags that take arguments). Read the documentation for ns_register_adptag for more info.

Although this approach is more flexible, it also requires you to restart AOLserver to make changes.

3.3 Templates

Templates are very flexible and do not require an AOLserver restart. You can find full documentation on this at /doc/style.html.

Basically, if you have a .tcl page that has the Tcl and SQL code in /test/mypage.tcl, you have this page call ad_return_template at its bottom. ad_return_template will search for an .adp template at /templates/test/mypage.*.adp and return it.

You can have several templates with different interfaces or even languages, such as mypage.plain.adp (for users than want text-only) or mypage.fancy.adp (for users that want graphical site) or mypage.plain.pt.adp (for users that speak Portuguese). ad_return_template will server the page according to the user's preferences.

This means that programmers will edit the .tcl pages and define some variables that HTML designers will then use in the the .adp templates they will handle. If I am not mistaken, there are mods for Dreamweaver to handle adp pages.

Unfortunately, because the templating module is fairly new, only a few modules are template-enabled, ecommerce being one of them.

3.4 Karl's Dynamic Publishing System

Karl Goldstein, who works for ArsDigita Corp., is working on a very powerful publishing system that was included in ACS/Oracle 3.2.3. You can download this module and get it working on your OpenACS installation (this is not included with OpenACS).

This modules uses XML and defines som special tags that completely separates programming from presentation. People that have been using it told me that it's really nice.

The URL for download and documentation is http://karl.arsdigita.com.


Next Previous Contents <% ns_puts [nsv_get mkm_includes mkm_oldContentFooter_inc] %>