User:neilw > Testing

Testing

heh?

Other

 

profile photo

 

Introducing the ForumTopic Template

[ "heh?", "Other", "Introducing the ForumTopic Template", "Tag Cloud" ]

So we've learned that an API-based approach won't work for our application, but we know that the API is the best (and sometimes only) way to get complete information about a page.  Are we stuck?  Of course not!

One thing we definitely can do is access the page variable and the page contents (via wiki.page() or page.xml) of other pages; we're already doing that with no problems, even on private pages.  We can exploit this capability to solve our problem by embedding our desired information in the page contents.  It would be preferable to do this automatically, with no user intervention.  Thus we introduce the ForumTopic template.

Our goals for the ForumTopic template will be two-fold:

  1. Automatically embed useful metadata that we can later use when generating the forum topic list.
  2. Improve the presentation and functionality of the topic page.

 

Tag Cloud

Update of Tag Cloud code is below.  Changes made:

  1. Slightly changed algorithm to create initial list of maps, new version is a bit cleaner and more efficient.
  2. Added code to handle "define" tags
  3. Added code to handle exclude tags
  4. removed quotes from non-string values (e.g., "true", "false").  I.e., using native types rather than all strings
  5. Simplified calculation of maxValue and minValue.
  6. re-used tagListofMaps rather than creating a new list each time
  7. Various other small efficiency tweaks (minimize the number of sorts, etc.)
  8. Each output tag is wrapped in a <span> now, instead of <li>

Basic tag display algorithm is completely unchanged.

 

Tag page

Files 1

FileSizeDateAttached by 
 content_xml
No description
3.04 kB20:10, 4 Sep 2008neilwActions
Viewing 4 of 4 comments: view all
Do the tag cloud code work only in 8.08? Thanks
Posted 16:14, 23 Oct 2008
I'm not aware of any 8.08-specific code in here.
Posted 20:28, 3 Nov 2008
Thanks, Neil. So it looks like I have a problem...a stupid problem of copy/paste!!
Posted 18:30, 17 Nov 2008
Heya, i was getting an Error:

/p/span, function 'map.keys' failed with response:
missing value for parameter 'map' (index 0)

This was because of pages with no tags.
Adding "if (#p.tags > 0) {" around the "foreach (var t in map.keys(p.tags)) ..." excludes pages with no tags.
Posted 14:43, 3 Dec 2008
Viewing 4 of 4 comments: view all
You must login to post a comment.
Powered by MindTouch Deki v.8.08.2