Multi-Level Tags in Sidebar

Jun 26, 2005 00:48


This is code to display your tags in a sidebar box. By naming your tags using a delimiter, for example animals:cats:tabbies or animals:cats:siamese, where the colon is the delimiter, you can display a heirarchical list of tags. If you feel your tags list will take up too much space in the sidebar, there is example styling provided to limit the ( Read more... )

!old, sidebar, tags

Leave a comment

miggy July 4 2005, 03:16:53 UTC
This is brilliant! I'll definitely be using it, but I do have one question.

I've got a heirarchical set-up going for icons I post, where every post is tagged with both "icons" and "icons: topic". Whoo, I'm already halfway there in terms of organizing stuff! However, there is a space after the colon. Since there's already a divider there, does this code provide the ability to look at the content after the colon and say, "Okay, all icon tags have a space, so colon-space-angel will be listed before colon-space-buffy"? In other words: can I use my tags as-is with this code?

If it needs to be only the code-determined divider between the various levels of tags, then not a problem, I'll change my tagged posts. But I figured I'd ask before I dove into all that.

Thank you!

Reply

murklinstest July 4 2005, 04:19:16 UTC
Should work just fine. If you ever accidentally tag something without the space, though, that tag will appear to violate the alphabetical order. As long as you're consistent, I'd anticipate no problems.

And OMG, pretty, pretty icons! I just looked at your journal and you have just the Hogwarts icon I've been pining for but too lazy to actually look for. You say comment and credit, so I'm gonna go do that.

Reply

miggy July 4 2005, 04:28:13 UTC
Fantastic! Thank you for the coding (and the comment ;) ). It'll be incredibly useful, as I've been using my link list for the icon tags and I'm running up against the limit.

Reply

miggy July 4 2005, 05:43:00 UTC
One more question (sorry!) before I twist my Flexible layer around too much: I have custom code in place under print_sidebar () already. Where should I slot in your code to get this all to work as one big, happy, page-lengthening family? I tried a few different ways and just got errors when I tried to compile the code. Thanks!

In-place code:

function print_sidebar()
{
var string extra1_title ="";
var string extra1_content ="";

$extra1_title = """
  • FAVORITE ICONS
  • """;
    $extra1_content = """


  • ... )
  • Reply

    murklinstest July 4 2005, 06:06:30 UTC

    From my code, copy everything from ##### Config ##### up to and including the curly brace just before ##### Specify Box Order #####. Paste that into your code just before the print_userpic() line.

    Then from my Specify Box Order section, copy this line:

    if ($list != ""){print_sidebar_box($tag_title, $list);}

    Paste it into your existing code somewhere in your list of print calls, wherever you want the tags list to show up. For example, to show the tags between the calendar and your FAVORITE ICONS box, it should look like this:

    print_userpic();
    print_sidebar_blurb();
    print_sidebar_linklist();
    print_sidebar_calendar();
    if ($list != ""){print_sidebar_box($tag_title, $list);}
    print_sidebar_box($extra1_title, $extra1_content);

    Then, to provide the styling for your tags list, copy the entire print_custom_head function from my code and paste it after the final curly brace in your code. Don't forget to remove the blue code if you don't want a scrolling tags box.

    Reply

    miggy July 4 2005, 06:18:45 UTC
    Aha! I was playing around with trying to put that part of the code before the extra box info, and the rest after. No wonder it didn't work.

    Thank you again!

    Reply


    Leave a comment

    Up