Re: newbie questions: common components in django

2009-07-19 Thread Gabriel Gunderson

On Sat, Jul 18, 2009 at 7:08 PM, online wrote:
> I know i can have common stuff like this in django
>
> 
>
> {% include "header.html" %}
>
> 
> blah
> 
>
> {% include "footer.html" %}
> 
>
> but it seems i need to pass data footer.html and header.html every
> time i include these pages?

There are several ways to do this, but when you're asking about
headers and footers, the obvious answer seems to be template
inheritance.

http://docs.djangoproject.com/en/dev/topics/templates/#template-inheritance

Best,
Gabe

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newbie questions: common components in django

2009-07-18 Thread Alex Gaynor

On Sat, Jul 18, 2009 at 8:08 PM, online wrote:
>
> Hi all,
>
> I know i can have common stuff like this in django
>
> 
>
> {% include "header.html" %}
>
> 
> blah
> 
>
> {% include "footer.html" %}
> 
>
> but it seems i need to pass data footer.html and header.html every
> time i include these pages?
>
>
> Thanks
> >
>

Check the docs for information on template context processors or
inclusion template tags.  Either of those is a perfect solution to
common data needed on every page.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you
want" -- Me

--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



newbie questions: common components in django

2009-07-18 Thread online

Hi all,

I know i can have common stuff like this in django



{% include "header.html" %}


blah


{% include "footer.html" %}


but it seems i need to pass data footer.html and header.html every
time i include these pages?


Thanks
--~--~-~--~~~---~--~~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---