iAct - A multi-lingual web development and templating framework built on Apache and mod_perl. DESCRIPTION iAct is a web development and templating framework built on Apache and mod_perl. The basic premise of iAct is that a webpage is not a linear sequence of html markup, but a collection of named chunks called sections, which insert themselves into more general templates. iAct encourages structured reuse of html code and design elements, by moving all the "skeleton" code (, , s used for layout, etc) out of the individual html pages, into template files. These templates can in turn embed themselves into more general templates. This results in a global tree hierarchy of templates, with the URL-mapped pages as its leaves. A small, purely declarative language is used to define sections within pages, use parent templates, import sections from other files, and define gaps where named content should be inserted. From this language, Perl routines can be called by their name, and their output inserted into the stream. These perl subs have full access to the sections on the file they were called from, and on the templates it uses. iAct is thoroughly multi-lingual; content can be entered in multiple languages, in separate files (blah.ihtml.en, blah.html.es) or within a single file, using the <% lang %> command. This is integrated all the way to the ContentHandler, which determines a language preference list from the user's request, and sets the right http headers for the response language. INSTALLATION Installation of the Perl modules for iAct is as usual: perl Makefile.PL make make test make install Once installed, iAct needs to be activated in the Apache configuration. See the file INSTALL for details. USING iACT Once installed, iAct handles files with the ".ihtml" extension. (This can be changed: if you want to build your entire site with iAct, you can tell Apache to give it all the files under your document root, and tell iAct to take .html files as well as .ihtml ones.) IHTML files are just like plain HTML ones with a few commands added, which perform templating operations. The basic realization that iAct was built upon, is that HTML files tend to share a lot of "skeleton" code: the and tags, headers and footers, layout tables, navigation elements common across entire zones of your site, etc. iAct's templating language lets you write this skeleton code once and for all, and then write pages that just "fill gaps" in it. Files with "skeleton code", which cannot be directly requested from the browser, are called template files. In iAct terms, when an IHTML file defines values for gaps to fill in a template, the template is said to be the "parent" of the file. For example, if all the pages on your site have this form: ((title goes here)) ... some common header ...
... some common left navigation...., followed by ((some stuff that changes from page to page at the bottom of the left column)) ((the same title again))

((contents of the page)) Then you can write the global template for your site (/www/tmpls/global.tmpl) as: <$ title $> ... the common header ...
... the common left navigation.... <$ left_column $> <$ title $>

<$ contents $> Then an individual page (/www/html/somepage.ihtml) could be: <% parent "/global.tmpl" %> <% section title %>My Wonderful Title<% /section %> <% section left_column %> Crap crap crap that goes at the bottom of the left column <% /section %> <% section contents %> The main contents of my page <% /section %> The real power of this is that files don't need (and won't want to) have the global site template as their direct parent: you can have as many levels of <% parent %>s as you want. The IHTML file fills gaps in its immediate <% parent %>, which fills gaps in its own, and so on. This lets you have a template for each part of your site, while sharing parts across the whole site too. In iAct terms, a <$ section_name $> command is a forward-insertion: a gap in a more general template is filled with a value defined in a more specific template (such as the user-requested IHTML file itself). Sometimes you will want to do the opposite: define some content (or design element) in a very general template (used by many individual pages), and insert it in various places on pages. For this, you use a backward-insertion. The definition is the same: In a general template, sometmpl.tmpl: <% section "button_arrow" %>
--->
<% /section %> And then in an file that wants to include a button with an arrow, and that has sometmpl.tmpl as one of its ancestors (or <% import %>ed from one): <@ button_arrow @>. Note the <@ @> instead of the <$ $>; this is what tells iAct to look for this section "backwards", towards the parents. There are several other other commands, and many other features in iAct, including support for multi-lingual content, conditional inclusion of text, dynamic applications calling Perl code from IHTML and manipulating IHTML sections from perl, theme support (alternate versions of the same templates, offering the same features with different looks), etc. See the html documentation for details (it is still being written at the moment). AUTHOR iAct was written by Roger Espel Llima for iAgora LLC (http://www.iagora.com; software@iagora.net). CONTACT There is a mailing list about iAct. To subscribe, send an empty email to . There is a companion mailing list about iA::CMS, the Content Management System for iAct. To subscribe, send an empty email to . LICENSE Copyright (C) 2000 iAgora, LLC . This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See the files LICENSE and LICENSE.GPL for more details. Please read the copyright statement on each file of the iAct distribution, as some of the files can be redistributed only under the terms of the GNU General Public License, and others can be redistributed under the GNU General Public License or the Artistic License, at your choice.