> however, considering such changes yield little benefit vs the changes to the
> parser. I think making your data more self contained does get you better
> result, instead of doing this in your controller, i recommend to do it in
> your model.
>
IMO this is a step backward for two reasons:
1) Additional code just for the presentation of content.
2) (Worse) the model would now contain some presentational logic (e.g.
I would have to change it if I wanted to add some more information to
(say) the rows of a table rendered in the template layer).
Fundamentally, there is some code required to merge together data from
two or more sources. Should this be done in the model, view or
controller. I think the model is the wrong place (it makes too many
assumptions about presentation). In my mind as its a presentational
element, the view is the place to do it *as long as it does not cause
over complexity in the template*. In my mind, bracket syntax on arrays
does not really cause too much complexity.
But anyway, thats just my opinion, I respect yours.
> In addition, depends on the kind of ORM you are using this is actually a
> quite popular optimization pattern call counter caching, which you have a
> new column holds the counter value of your associated objects and it updates
> on post create and post delete, so it doesn't need seperate query for most
> of the time.
>
Sure, but thats another subject (e.g. if you are stuck with a certain
amount of legacy code, you cant just pick up a new ORM).
> # Template :
> Alternatively, a different technique you can also create a filter like this
> , but since currently there are no easy want to get a reference of current
> context object, If you really want to do this, then i can should you how to
> do it..
>
> ({{ number_of_posts_per_category| at
category.id }})
Well thats not as readable as [
category.id] is it? Its not that
important as its solvable in a million different ways, but its just
something that I feel constrained by when using template systems that
dont allow this....