Posted by Zeke Harris |
|
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?
Thanks! What? You wanted a sig? |
|
Posted by Herbert Poul |
|
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 ? ;) |
|
Posted by Herbert Poul |
|
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 %} <li> <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 %} </li> {% endfor %} </ul> Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
btw. i've now written a short documentation about the 3 macros which currently exist:
http://sct.sphene.net/wiki/show/Wiki/ Hey, we have Signatures !!! Great, isn't it ? ;) |
Please login to post a reply.