Jonas Liljegren wrote:
> I'm using callbacks for many widgets. Among other things for building
> links with query parameters, like
>
> [% jump('Link text', 'path/file', arg=value arg2=value2 ) %]
>
> I have functions for retrieving objects, formatting dates, displaying
> form elements (with preselected values dependent on situation) and
> other things.
That's different. That's a formatting function, and it's part of the
presentation layer. Things like that are unavoidable. I use the date,
format, and table plugins all the time. That sort of stuff is totally
necessary. In fact even HTML::Template supports things like that now.
What I object to are mostly functions that fetch new data.
> Since a page is built up from diffrent parts (boxes or areas on the
> page) each part could have it's own setup code. In my thinking, it's
> at least in some degree a design and presentation issue if you want to
> display some specific box on a page. That box would not be specific
> for the requested information but rather somthing that comes along
> anyway, like a menu or banner or infobox or anything else.
I've never needed to pass data for things like that. I always just make
the navigation stuff a static part of the template, since it is not
dependent on the user input. However, if you're doing something where
you actually vary the navigation based on request info (like
highlighting the current area), then that piece of data is a result of
the request and should be calculated and passed along. In my last
project, I would probably have used inheritance to add the setup work
for this to all of the controller classes, i.e. before running the
search, load the "navigation context" data object and add it to the
template data.
- Perrin