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

Comments 55

magic_beans June 26 2005, 10:56:26 UTC
This worked beautifully for me, thanks a lot :)

Reply

murklinstest June 26 2005, 14:51:10 UTC
Glad you like it. I think I forgot to stress that if you go with the scrollbars option you should probably alter the scrollbar colours that are supplied. You'll need to use IE to see any changes. My example colours are a rather insipid yellow and green, which I imagine will look rather unattractive in themes other than "Pastel Spring."

Reply


caitirin July 1 2005, 18:30:10 UTC
What a COOL customization. Just one question, and please pardon my ignorance if this is obvious, but is there a way to get it to show up AFTER my links list in my sidebar?

Reply

afuna July 1 2005, 18:40:24 UTC
In this part of the code:

##### Specify Box Order #####

# mt:20050627
# Okay, now that's done, just print out all your sidebar boxes in the order you
# want, including a call for this one -- print_sidebar_box($tag_title, $list) --
# nested within an if statement to prevent tags box from printing in the event
# of no visible tags.
print_userpic();
print_sidebar_blurb();
if ($list != ""){print_sidebar_box($tag_title, $list);}
print_sidebar_linklist();
print_sidebar_calendar();

##### End Box Order #####

arrange the boxes in the order you want them to be printed out. So, for instance, for putting your linkslist above your tags but keeping everything else in that order, do this:

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

Blue text indicates what lines have been edited.

Reply

caitirin July 1 2005, 18:55:21 UTC
Thanks SO much! It worked like a charm. Much obliged for this very nifty feature!

Reply

afuna July 1 2005, 19:02:09 UTC
You're welcome :)

I can't take credit for anything though; all the code, including the instructions for rearranging the sidebar boxes, are murklinstest's doing.

Enjoy your new customizations :D

Reply


dreamnoir July 2 2005, 00:57:36 UTC
This code is absolutely brilliant! I edited some of the style to my liking, but the code works absolutely great! Thanks so much!

Reply

murklinstest July 2 2005, 06:44:17 UTC
You're welcome. Glad you like it!

Reply


notemily July 2 2005, 22:43:16 UTC
Making the delimiter an empty string will result in an un-tiered list, which may be what you prefer. but this code is serious overkill for that purpose.

I'd love an un-tiered list, as I don't anticipate having many tags. but I know next to nothing about css, so I don't think I'd be able to figure out a hack that wasn't serious overkill. any suggestions, or should I just use this one? (:

Reply

murklinstest July 3 2005, 02:40:05 UTC
I've made a new post that shows the code for a simple tags list. I can't believe that no one's posted that before, so I can only hope I haven't just posted redundant code. Anyway you can find it here. As I note in the post itself, I haven't tested it much! Let me know if you have trouble.

Reply

notemily July 3 2005, 03:10:47 UTC
Awesome! Thanks so much. I'll have to play around with that.

Reply


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


    Leave a comment

    Up