[jifty-devel] Template::Declare defaults for Jifty

David Brunton dbrunton at yahoo.com
Wed May 9 14:37:13 EDT 2007

Hi nifty Jifty people,

I have found that I really like Template::Declare.  Having used Mason, Petal/TAL, HTML::Template, TT, and others in the past, I found that Template::Declare was an immediate slam-dunk for my visceral need to keep markup separate from logic.  Little did I know that the answer lie in getting rid of markup entirely!  I've never been so happy.

I do have a question about it, though.

The default wrapper template does some magic for me that I want to keep.  But it also has one behavior I'd like to override (namely, putting the salutation and navigation at the front of the HTML for each page).  It turns out that simply putting 'private template salutation => sub { };' makes the salutation disappear, and I can do the same thing with menu.  But then I can't use "show 'salutation'" later and have it display the salutation.

Alternatively, I could deal with all positioning and display in my CSS.  But that seems suspiciously close to hacking around the problem rather than solving it.

What I would like to be able to do is either have both items left out of the default wrapper template and included by default in a View.pm generated at application setup time, or have them put into a template of their own called "defaultheading," which I could then "turn off" by the method described earlier.  I would still have access to salutation and menu to display them wherever I like in my HTML tree.

I think the latter would be a relatively easy change- I would replace this section:
        div {
            show 'salutation';
            show 'menu';

        show 'defaultheading';

and create (for now) a Mason template called defaultheading that wraps both of these in a single div.  That should replicate current behavior for people who don't want to muck with it, and let me do what I want.

I would also be willing to port the existing default Mason templates to T::D when it's time for that to happen.

Thoughts on that?  Other ideas?


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the jifty-devel mailing list