Sphene Community Tools


Copyright © 2007-2018 by Herbert Poul

You are not logged in.

Change Language:

AddThis Social Bookmark Button

A Django site.

Powered by Sphene Community Tools
Board » General » News Macro

Cruising through the code I noticed a News Macro, but couldn't find any documentation as to how exactly it works? I haven't figured out exactly how the macros work at all -- how they're parsed, where they're called from, etc; so I'm kinda lost. However, I noticed that it does work great on this site, and I think it's an awesome feature - it's an easy way to make wiki pages into blogs (with comments!), for example. I'd really love to understand how all this works, could you explain it to me?

What? You wanted a sig?
i can give you a short usage guide now ;) .. if you need a deeper introduction you'll have to wait until i'm @home and have time ..

in a wiki snip enter: {news category=5 baseURL=/board}

category is the ID of the category you see in the URL ..

i'm currently not that happy with the macro system.. it's not very extensible yet..
Hey, we have Signatures !!! Great, isn't it ? ;)
ok.. what i probably should have mentioned.. the news macro includes the threads from a forum category :)
all replies are then more or less "comments" .. so i guess.. yes.. you could use it as simple blog with comments.. (it's than actually just a board)

in addition to 'category' and 'baseURL' it supports the parameters:
- 'limit' - which defines how many threads should be displayed.. (by default.. this is 5 .. and that's the way i'm using it on this page..)
- 'templateName' - a django template which is used to render the threads... (by default: wiki/news.html)

since i obviously don't provide an example template.. here is the one i'm using:

{% load sph_extras %}

<ul class="news">
  {% for thread in threads %}
      <div class="subject">{{ thread.postdate|sph_date }}: {{ thread.subject }}</div>
      <div class="body">{{ thread.body_escaped }}</div>
      {% if baseURL %}
        <div class="comments"><a href="{{ baseURL }}/thread/{{ thread.id }}/">{{ thread.replyCount }} Comments</a></div>
      {% endif %}
  {% endfor %}

Hey, we have Signatures !!! Great, isn't it ? ;)
btw. i've now written a short documentation about the 3 macros which currently exist:

Hey, we have Signatures !!! Great, isn't it ? ;)

Please login to post a reply.

Powered by Sphene Community Tools