[Koha-devel] template system abuse

Kyle Hall kyle.m.hall at gmail.com
Thu Apr 13 17:20:58 CEST 2006


This discussion made me think of a great article I read awhile back.

http://www.massassi.com/php/articles/template_engines/

It's written about php, but is just as applicable to perl because there are
apache mods to use perl just like php.

I'm actually using the template style in the article for a project I'm
working on.

Kyle

On 4/13/06, Robert Flach, Poet and Critic <webmaster at allauthors.com> wrote:
>
> I don't do a lot of hacking on koha, and I've never submitted a patch,
>
> though I do use it and am an avid follower of the development list.  (I
> am a web application developer by trade though).  So take this for what
> it's worth.
>
> It's a bad idea to generate ANY HTML in the code.  Keep the presentation
> in the presentation layer (templates).  No matter how obvious or useful
> a particular choice may seem now, it will cause you heartache down the
> road.
>
> Regarding the select box, Imagine that I as a template designer wanted
> to substitute a column of checkboxes or radio buttons for the select
> box.  With the proposal below it would be impossible, yet that is merely
> a matter of presentation which should be able to be changed only by
> modifying the templates.
>
> Adequate objections have already been made to the fully constructed url.
>
> Good luck, and thank you all for a great, robust product.  Keep making
> it more robust, don't make it less.
> Sincerely,
> Robert Flach
>
>
> Owen Leonard wrote:
> >> and in template:
> >>
> >> href="<!-- TMPL_VAR NAME="url" -->"
> >>
> >
> > Paul's point is the same as I would like to make: using this method
> removes
> > the option for the template designer to use a form instead of a
> link.  What
> > about leaving both options open?  Have the script create the URL
> variable
> > but also make all the individual variables available for use?
> >
> >
> >> <!-- TMPL_LOOP NAME="items" -->
> >>   <option value="<!-- TMPL_VAR NAME="value" -->" <!-- TMPL_VAR
> NAME="selected" -->><!-- TMPL_VAR NAME="name" --></option>
> >> <!-- /TMPL_LOOP -->
> >>
> >
> > Paul, is this method translator-safe?  I thought you had had
> difficulties
> > in the past with constructions like this?
> >
> > In both cases, past practices have colored my attitude towards these
> > practices:  Any time the script generates HTML, you run the risk of no
> > complying with the standard chosen by the template designer.  This was a
> > problem when we were transitioning between HTML and XHTML.  If we can
> all
> > agree on complying with XHTML transitional (at least), we just need to
> > follow the rules:
> >
> > URLs which are generated by the script must include proper encoding of
> > ampersands (&amp; instead of &)
> >
> > "selected" attributes generated by the script must follow the rules of
> no
> > implied attributes: selected="selected"
> >
> > So it comes down to three suggestions from me:
> >
> > 1. Make options available to the template designers.
> > 2. Ensure that generated markup is XHTML compliant
> > 3. Find out if we're breaking the translator script :)
> >
> >   -- Owen
> >
> >
> > _______________________________________________
> > Koha-devel mailing list
> > Koha-devel at nongnu.org
> > http://lists.nongnu.org/mailman/listinfo/koha-devel
> >
>
>
>
>
>
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at nongnu.org
> http://lists.nongnu.org/mailman/listinfo/koha-devel
>



--
IT Tech
Crawford County Federated Library System
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-devel/attachments/20060413/2294ed01/attachment-0002.htm>


More information about the Koha-devel mailing list