Sphene Community Tools

Community

Copyright © 2007 by Herbert Poul
You are not logged in.
Login
Register

Change Language:



AddThis Social Bookmark Button

A Django site.

Forum template tags

Board / TemplateTags

This documentation explains the templatetags provided by the Board application.

You need to {% load sphboard_extras %} to use them.

1. Display all available categories

It might be useful to display a hierarchical list of the forum categories - e.g. for a "jump to forum" select box or similar. This can be done using the sphboard_recursive_category_iterator template tag.

1.1. Usage

The content between sphboard_recursive_category_iterator and endsphboard_recursive_category_iterator will be taken and rendered for every category in the hierarchy. In each iteration the context will be filled with the following template variables:

1.2. Example

The following example displays a simple select box which will jump to the selected forum as soon as the value is changed.

{% load sphboard_extras %}

<select name="category" onchange="if(this.value) document.location = this.value;" class="sphboard_selectcategory">
  <option value="">Jump to category</option>
  <option value="">------------------</option>
  {% sphboard_recursive_category_iterator %}
    <option value="{{ category.get_absolute_url }}">{% for i in depthrange %}--{% endfor %} {{ category.name }}</option>
    {{ children }}
  {% endsphboard_recursive_category_iterator %}
</select>

Tags:

Last Modified: 2008-04-12 17:07:43 by Herbert Poul - [ Snip Changes ] [ Wiki History ]

0 Comments

No comments yet.

Post New Thread



Powered by Sphene Community Tools