Newbie to Web programmer here. Please be gentle.

I am trying to get my head around HTML helpers and see that they have
been discussed so much and so often in this group that (1) I can't
find what I'm looking for and (2) I am thinking there ought to be a
sticky someplace that talks about their proper care and feeding.

In particular, let's take the Image Blog example from The Book, file
default/index.html:

{{extend 'layout.html'}}
<h1>Current Images</h1>
<ul>{{=LI(A(image.title, _href=URL("show", args=image.id)))}}
{{for image in images:}}
{{=LI(A(image.title, _href=URL("show", args=image.id)))}}
{{pass}}
</ul>

My first approach to writing this would have been to use native HTML
as much as possible so as to make porting to or from templates as easy
as possible. Also helps (me) with readability. Something like:

{{extend 'layout.html'}}
<h1>Current Images</h1>
<ul>
{{for image in images:}}
<li><a href="{{=URL("show", args=image.id)}}">{{=image.title}}</a></
li>
{{pass}}
</ul>

This approach seems to work -- but I am wondering if there is an
advantage to doing it with helpers that I am missing.

Reply via email to