Thanks Malcom. That's sorta what I expected to hear. I'm still trying  
to work out the best way to do what I want to do (mostly static  
websites with django's awesome templates and the occasional reusable  
django app plugged in).

Maybe writing views for each page and setting those types of  
variables there is the better way to go after all.

Thanks for the tips.

Sean



On Aug 18, 2006, at 5:28 PM, Malcolm Tredinnick wrote:

>
> On Fri, 2006-08-18 at 12:14 +0900, Sean Schertell wrote:
>> Hi folks,
>>
>> Okay, so I got my little staticpages app working (thanks adrian), and
>> now I can happily throw sometemplate.html in my templates/ directory
>> and I can view the page at mysite/sometemplate. Great! And it extends
>> my base.html template too so all my header/footer stuff is DRY.  
>> Hooray!
>>
>> But what about the bits that change from page to page, like the page
>> title, or the body "id" attribute, html metatags, etc. Is there any
>> convenient way to pass those values in from the child template? Right
>> now I'm using blocks in my base.html like this:
>>
>> <body id="{% block page_id %}{% endblock %}">
> [...]
>
>> Is there any way then to more elegantly set the page title, body id,
>> etc without using blocks and without writing view methods?
>
> You have to do it the way you are doing it now. Template inheritance
> only allows you to override blocks, not set variables in the context.
>
> Remember that you are in a slightly fringe area. Normally, if you were
> having per-page id settings, you would creating the pages through  
> views
> and you would pass in the appropriate id value(s). If you don't  
> want to
> have views and just have templates, then you have to do it via blocks.
>
> Regards,
> Malcolm
>
>
>
> >
>
>

::::  DataFly.Net  ::::
Complete Web Services
http://www.datafly.net


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to