Multi-level Tags in Sidebar

Jun 25, 2005 14:02


This is code to display your tags in a sidebar component. 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 ( Read more... )

Leave a comment

Comments 118

bibliotech June 25 2005, 17:35:06 UTC
THANK YOU! It worked perfectly!

Reply

murklinstest June 25 2005, 19:35:51 UTC
I think I've fixed the nasty bug. I must have been really tired when I made my earlier attempt at a fix, because it was SO obvious. Anyway, I'm going to post the revised code, so you'll probably want to check back. Do you know the usual way to post a fix -- brand new post or edit of the old one?

Reply

bibliotech June 25 2005, 19:39:30 UTC
I've seen a few people just edit their original entries. I know I save all useful posts to my memories, so I'm more likely to catch a fix at the original entry.

Reply


sir_brettley June 26 2005, 02:01:45 UTC
I like it. I was thinking of something similar.

What happens to your code if you have something like foo:bar:bam ?

Also, with a delimeter like ":" it displays pretty well in other styles, but other delimeters may not print so nicely in terms of readability. Too bad we can't get LJ to retrofit tags with this kind of a feature.

Reply

murklinstest June 26 2005, 07:28:20 UTC
What happens to your code if you have something like foo:bar:bam ?

This code will create a multi-level list (by multi I mean "not limited to two") so if this tag were your only visible tag, it would display as:

  • foo
    • bar
      • bam


And yes, it's a shame that your chosen delimiter might not be too visually appealing in some other layouts, but I suppose if it bothers someone enough they can go in and rename all their tags. And I definitely would have liked to get a built-in tag bundling feature, like you can get at del.icio.us, but I can live with this hack for now.

Reply


(The comment has been removed)

murklinstest July 8 2005, 23:28:31 UTC
I'm afraid I've never tried to put components on both sides, but I shall answer as best I can, using this tutorial as my reference. As I understand it, you use the print_my_components function to display your right column and you show custom components on the left. The first thing you need to do is copy *most* of the print_free_text function that I made to show the tags component. Start your copying at the
##### Config ##### line and stop near the bottom of the function just before these lines:

# mt:20050627: This adds the Tags component, if there are visible tags.
if ($list != "")
{
print_comp_header($tag_title);
"""$list""";
print_comp_footer();
}Now paste the copied section of code at the top of your page_layout function. You might want to add some comments around it so you remember that this section builds the tag list. Now to display tha tag component, you need to add the lines that make up a custom component, somewhere in with all your other custom components. You choose where it fits into the order. One ( ... )

Reply


(The comment has been removed)

murklinstest July 29 2005, 16:04:30 UTC
You're most welcome. And you probably weren't alone with the near panic!

Reply


celticdreamz July 29 2005, 14:49:14 UTC
while the code did add the tags to the sidebar, all my other components disappeared... what am I doing wrong?

Reply

murklinstest July 29 2005, 15:55:29 UTC
If you could make your code viewable and privide a link to the layer, I'll take a look and see what's up.

Add this to the top of your layer: layerinfo sourceviewable = 1;

A link to your layer would then look like this: http://www.livejournal.com/customize/advanced/layersource.bml?id=somenumber

For the somenumber portion, sub in the LayerID you see next to that layer in your Layers page.

Reply

celticdreamz July 29 2005, 16:27:48 UTC
I deleted all the tag code, but I'll give it a shot & post the code.

Keep in mind that I am damn near clueless when it comes to layouts.

Reply


Leave a comment

Up