in reply to Re^3: Output should have multiple segments
in thread Output should have multiple segments

Right. So instead of loading one subtemplate that receives the data structure I have to produce two datastructures (or often just remember which subtemplates will I want to use) and call two subtemplates. Lovely. Messy!

  • Comment on Re^4: Output should have multiple segments

Replies are listed 'Best First'.
Re^5: Output should have multiple segments
by moritz (Cardinal) on Jul 16, 2008 at 14:42 UTC
    If the structure of your desired output requires two data structures, you create them.

    For me that's not a good reason for moving program logic into the template.

    If you're not convinced, think of what happens when you chose to add more views. There are plenty of possible output formats, like html, xml, pdf, json, yaml, plain text, ... - would you really want to duplicate code for all of those templates?

      So it is a good reason for moving display logic into the controler, right? The fact that the HTML format requires that some part of the stuff produced by the template has to end up in the <head> is an HTML-specific implementation detail, not something that the controler needs or even should know about. Exactly because of the many possible output formats I should not polute the controler with stuff required by the implementation specifics of one of the output formats.