On Wed, 4 Feb 2004, paul vudmaska wrote:

> Amrita? kind of cook but i've tended to avoid template
> systems. ruby scripting is (so easy/intuitive) maybe
> just a little more sophisticated than a mark-up
> language so why learn another? Maybe ERuby and just
> sandbox a script/template?

Well, for my purposes, Iowa _generally_ just uses regular HTML with an 
extra attribute, 'oid'.  There are a few special tags like <repeat> and 
<if>, and a special bit of syntax where @WORD where calls the method WORD 
and inserts its return value.  Also, one can insert other components by 
importing them and refering to them much like an HTML tag.  So, a few 
differences from plain markup, but not much.

And the net result is that I can do things like this:

<p>Ad tag summary as of: @current_time</p>
<ul oid="tagList">
  <li>@tag</li>
</ul>

And then in the seperate code file, the code would be:

<%
  class AdTagSummary < Iowa::Component
    attr_accessor :tag

    def current_time
      Time.now.to_s
    end

    def tags
      r = []
      application.dbpool.getConnection do |dbh|
        sql = 'select distinct(origin_code) from ad_responses'
        dbh.select_all sql do |row|
          r.push row[0]
        end
      end
      r
    end
  end
%>

<?
  tagList {
    item = tag
    list = tags
  }
?>


The code is cleanly seperated from the presentation, allowing one to muck 
with the presentation at will without worrying about the code, and the 
markup is just plain HTML with a few special things, so the learning curve 
is pretty low.


Kirk Haines