On 8/15/06, Seth Buntin <[EMAIL PROTECTED]> wrote:
> Is possible to have a view (and correct me if I am using my teminology
> wrong) that is accessible site-wide?
>
> For example:
> I have a blog that on the sidebar lists links that I put into the
> system when I find them.  Is it possible to fill that block in the
> site.html file (base template file) without having to get the
> information from the database on each different page?

You have dynamic data that you want to display on every page of your
site. The best way to do that is to write a custom template tag that
retrieves that dynamic data, and call this custom template tag from
within your base template file.

http://www.djangoproject.com/documentation/templates_python/#extending-the-template-system

You'll have to store the dynamic data *somewhere*, though, so either
the custom template tag should grab its data from a database, or a
file on your filesystem, or *somewhere*. If you're concerned about
performance, you can use the Django caching system to cache the
results of that template tag for a given amount of time. See the cache
docs:

http://www.djangoproject.com/documentation/cache/

Hope this helps,
Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~---------~--~----~------------~-------~--~----~
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