Monday, February 27, 2012

Re: How to generate common blocks?

Consider writing custom template tags for the common parts (assuming
they're dynamic).

https://docs.djangoproject.com/en/1.3/howto/custom-template-tags/

Brett


On 2/27/12 2:25 PM, "Paul" <peebor@gmail.com> wrote:

>I have a question regarding the use of the template mechanism.
>
>Say i'm using a common website layout with header, footer and in the
>center three columns. Only the center is specific to the request (so
>the specific view function will generate the center block), i'm not
>sure however what the best way is to generate the common blocks in the
>side bars. Lets say i want to have multiple blocks with dynamic
>contents (such as a random selected review or frequently searched
>items). I guess is can call specific functions to generate the common
>blocks but i would have to do so for each view function? This doesn't
>make sense to me because quickly blocks will be generated that are not
>actually used; would it be possible to do something smart? Like
>specifying block-functions inside the template code?
>
>Many thanks for any directions!
>
>Paul
>
>--
>You received this message because you are subscribed to the Google Groups
>"Django users" group.
>To post to this group, send email to django-users@googlegroups.com.
>To unsubscribe from this group, send email to
>django-users+unsubscribe@googlegroups.com.
>For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment