Sara (waterofthemoon) wrote in s2expressive,
Sara
waterofthemoon
s2expressive

  • Mood:
  • Music:

Comma-separated tags sidebar

Hi! I hope it's okay to post this here. I just switched to Mixit (which is directly based on Expressive), so I've been hacking at it a bit tonight, trying to bend it to my every whim.

I decided that I wasn't happy with the options of "cloud" or "list" for the tags sidebar module; the former looks cluttered to my eye, and the latter just takes up too much space with my plethora of tags. So using the framework of the existing function and some code I got from component_help a while back, I turned it into a simple comma-separated list.

Like so:

Yes, that's from my journal. Fear my mighty tags!

To achieve this effect, paste this entire function into your layout's theme or user layer. (If you already have a custom print_module_tags, you'll need to modify it or replace it entirely in order for this to work.) I've successfully tested this in both Expressive and Mixit, so it should work for both. Paid/permanent/early adopter users only, sorry! If you don't understand how layers work, please see this post for further information.

The code:

function print_module_tags(string title) {
    var Page p = get_page();
    var TagDetail[] tags = $p->visible_tag_list();
    open_module("categories", $title, "");
    var int tcount = 0;
    foreach var TagDetail td ($tags) {
        $tcount++;
        var string uses = get_plural_phrase($td.use_count, "text_tag_uses");
        var string security = $td.visibility;
        """<a href="$td.url" title="$uses, $security">$td.name</a>""";
        if($tcount < size($tags)) { print ", "; }
    }
    var string tags_url = $p.journal->base_url() + "/tag/";
    print """<div class="widget-footer"><a href="$tags_url" title="$*text_sidebar_tags">$*text_sidebar_tags</a></div>\n""";
    close_module();
}


Credits: None of this code is mine. The bulk of it was written by jai_dit and posted publicly at component_help, and the rest came from the Mixit source code. I just combined them to make it work for Mixit and Expressive.

Questions? Problems? Comments?
Tags: $acct level:paid or perm, advanced, how to:instructions, s2:theme layer, sidebar:tags
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 3 comments