[Charlotte.PM] The Template Challenge

Kurt W. Whitsel kwhitsel at gmail.com
Mon Jun 13 20:20:19 PDT 2005


Hey all,

Here is a very simple Template Toolkit solution for the Template Challenge.

Thanks for the data file William.

Kurt

On 5/24/05, William McKee <william at knowmad.com> wrote:
> Mongers,
>
> It's time for the Template Challenge. The idea is to show off the syntax
> and capabilities of the various template engines used by group members
> to learn new tricks and techniques.
>
> At the meeting last week, we drew up a sample HTML page which each
> template must generate along with some sample data. I've taken this
> data and placed it into the DATA section of a script which you can use
> to process your template. In addition, your template should calculate
> the total number of records and display its name (version optional).
>
> All templates must output accurate results based on the data but feel
> free to embellish the markup. We'll run the submissions and compare the
> results at our June meeting including checking for valid HTML/XHTML
> syntax so run your output through tidy or the HTML Validator at W3C[1].
>
> So far, here are the list of entries:
>
>  Template Engine     Champion(s)
>  ---------------     --------
>  Petal               William M
>  Template Toolkit    Kurt W
>  Text::Bind          William M
>
> Popular engines without champions:
>  HTML::Template
>  Text::Template
>  Mason
>
> If your favorite is not in the list or does not have a champion, please
> use the attached templates to submit an entry to the mailing list. Feel
> free to submit an entry for an existing engine; after all, there's more
> than one way to do it. Play as often as you'd like.
>
> I'm looking forward to seeing the results at our next meeting on June
> 16th (location is still being determined, stay tuned!).
>
> William
>
> [1] http://www.w3.org
>
> --
> Knowmad Services Inc.
> http://www.knowmad.com
>
>
> _______________________________________________
> charlotte mailing list
> charlotte at pm.org
> http://mail.pm.org/mailman/listinfo/charlotte
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: template.pl
Type: application/octet-stream
Size: 1395 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/charlotte/attachments/20050614/151edcca/template.obj
-------------- next part --------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><META http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>

    <h1>Charlotte Perl Mongers</h1>
    <h2>2005 Template Challenge - TEMPLATE ENGINE</h2>
    <table>
      <tr>
        <th width="200" style="text-align:left;vertical-align:bottom;padding-left:10px">Name</th>
        <th width="50" style="vertical-align:bottom">Phone</th>
        <th width="100">Res/<br>Comm <span style="vertical-align:sup">*</span></th>
      </tr>
      [% SET COUNT = 0 %] 
       [% FOREACH record = records -%]

      <tr>
        <td>[% record.first %]  [% record.last %]</td>
        <td>[% record.phone %]</td>
        <td style="text-align:center"> [% IF record.res %]Res[% ELSE %]Comm[% END %]
 </td>
      </tr>
       [% COUNT = COUNT + 1 %]
       
      [% END %]
    </table>
    <p>Total Records =  [% COUNT %]</p>
    <hr style="margin-top:25px;width:100px" align="left">
    <p style="font-size:9pt"><span style="vertical-align:sup">*</span> Residential or Commerical listing</p>
  
</body></html>


More information about the charlotte mailing list