Component: Multi-Level Tags with Catchall Category

Aug 21, 2005 09:55

This code is just like that of Multi-Level Tags in Sidebar, except for the following three things ( Read more... )

code:tagsbox:multi-level, layout:component

Leave a comment

murklinstest December 31 2007, 20:58:44 UTC
Sorry, those were sloppy directions. I didn't even ask to look at your layer!

I used to post things at component_help and other S2 comms, but that generally leads to people asking me to help them implement, and while I was totally cool with that in 2005, now it just makes me feel really guilty because I mostly don't have the time or inclination. :(

I like doing interesting personal customizations, though! And people who are really determined will seek me out here, like you.

There is a TagDetail property called security_count, which allows you to check the number of entries a tag has been used on, differentiated by entry type (public, private, friends, and group). I seem to recall it was buggy when it was first implemented? Something wrong with the counts of entries that were locked to custom friend groups. I don't know, maybe it's fine now -- that was years ago. Since I don't keep up with S2 anymore, except for the briefest of moments when I update my own journal layout once a year, I honestly would not feel confident using this property without some more research.

Reply

ainabarad December 31 2007, 21:20:54 UTC
I've been trying to seek out info on it, but so far no luck other than coming across a lot of code that I don't understand. (I've never really understood s2 and consider myself lucky that I know HTML! *G* LOL However, I can follow directions so I can be a whiz when it comes to copying and pasting code!) I don't use custom friends groups for posting (only reading journals) so that's not a problem for me. I don't have OCD, but I occasionally obsess over my LJ; I rarely complain about LJ, but I ranted once about not being able to mass edit tags or implement Javascript on the tags box. LMAO I'm not nearly as bad as that might make me appear though, just thoughtful, creative, and understanding when it comes to the extreme usefulness of tagging. :)

Let me know if you ever decide to add the security things to this tutorial (like friends see public and friends only tags, non-friends only see public tags, owner sees all tags, etc.) so I can implement it! If you do decide to seek out info you may even manage to find the code has already been written somewhere. (I wouldn't know if I saw it since I don't understand it well enough! LOL)

Oh, and regarding component_help... It's gone downhill a lot over the years. Back when Component was new people were happy to think up and share awesome codes like this, but there haven't really been any new tutorials in a long time other than fixing bugs and such. Members aren't supposed to comment asking for help on old entries and instead are asked to make a new post asking for help... and from what I've seen it's mostly just the incredibly sweet and helpful uniquewonders helping people and keeping the community organized. Because of that, I feel awful when I ask for help with anything (I don't want to cause someone else to have a headache) which is why I'm trying to completely finish customizing my layout with whatever code/tutorials I desire now so perhaps I won't be bothering anyone with new questions or tutorial requests for at least a few years.

Thanks again!!! You are undoubtedly made of awesome!!!

Reply

murklinstest December 31 2007, 22:01:21 UTC
Alright, my darling! You have talked me into it. :) Or, possibly I was already writing it before you posted your comment. Whatever. I hate to leave things semi-unfinished.

Take the base code of this post, then alter the same two sections as before, this time with this sparkly new blue code:

# mt:20050623
# If we're on a tag's last tier, we need to return a link to the tag,
# otherwise plain text is returned.
if (size $tags == ($pos + 1))
{
# mt:20050817
# Include the tag count and surround each list item with additional div for styling purposes.
# mt:20071231
# Show total count to journal owner, public + friends count to friends, and public-only to everyone else.
var int uses = $t.security_counts{"public"};
if (viewer_is_friend()) {
$uses = $uses + $t.security_counts{"friends"};
}
if (viewer_is_owner()) {
$uses = $t.use_count;
}
var string tc = " [" + $uses + "]";
$tier_code = """
$tier$tc""";
}

# mt:20050818
# Build the catchall list.
$catchall_list = "";
foreach var TagDetail t ($catchall)
{
# mt:20071231
# Show total count to journal owner, public + friends count to friends, and public-only to everyone else.
var int uses = $t.security_counts{"public"};
if (viewer_is_friend()) {
$uses = $uses + $t.security_counts{"friends"};
}
if (viewer_is_owner()) {
$uses = $t.use_count;
}
var string tc = " [" + $uses + "]";
$catchall_list = $catchall_list + """

  • $t.name$tc
  • """;
    }
    Does it look like it's working?

    Reply

    ainabarad December 31 2007, 22:30:25 UTC
    It's doing something odd to the tag levels... like it completely leaves out the very first tag before the first delimiter. For example, I have the tag "livejournal: public entries". It seems that now that tag is simply "public entries", yet still indented somewhat. Other than that huge problem (okay, it's probably simple to fix, but it makes the list look odd! LOL)... IT WORKS!!! IT REALLY WORKS!!! Eeeeeeeeee!!!!!! :D

    Reply

    murklinstest December 31 2007, 22:34:14 UTC
    Better link me to your layer. *sigh* Oh, S2.

    Reply

    ainabarad December 31 2007, 22:50:27 UTC
    It's right here: #4542390.

    Just look for "MULTI-LEVEL TAGS"

    I owe you big time for this!

    Reply

    HALT! ainabarad December 31 2007, 23:07:36 UTC
    I'm so sorry!!!!!!!!!! I just tried re-inserting it and it works now so it was definitely completely my dumbass mistake! I'm sorry! *hopes I catch you fast enough to save you a headache*

    Reply

    Re: HALT! murklinstest January 1 2008, 18:37:12 UTC
    I'm so glad you got it working, because I had to leave abruptly yesterday and didn't get another chance at the internet until just now, so you definitely caught me in time. :)

    Reply

    Re: HALT! ainabarad January 1 2008, 19:21:38 UTC
    Yay!!! I was worried you'd on it without checking your email!!! :)

    If you still want to play with s2, you could always take a crack at

    Reply

    Re: HALT! ainabarad January 2 2008, 00:05:28 UTC
    Nevermind! Thank you so much for all of your help! I won't bug ya anymore!!! ;)

    Reply

    Re: HALT! murklinstest January 2 2008, 00:26:37 UTC
    Hee, cool. (Missing }, yeah?) :)

    Reply

    ainabarad January 30 2008, 01:57:36 UTC
    Hello. It's me again. (Sorry.) I just noticed that when I view my tags page, the font in the multi-level tags component changes and has issues... it's bigger than what it should be and if you scroll down you'll see a line or two where the text is huge. I have no idea why it's doing that, but I did check my icon journal's tags page since I used it in that layout also as well as fairwells' tags page since she's using it and it is doing it on those journals/layouts as well. Any idea on what should be changed in the code to fix it? Take your time if ya need/want, of course. I appreciate all the help you give! This is really puzzling me. I tried specifying in the css portion the font family and size to use and that didn't help.

    Reply

    murklinstest January 30 2008, 02:21:34 UTC
    Unfortunately, I can't see the problem on either journal, which is probably due to one of two things: a) it's happening in the browser you're using, but not the one I'm using (Firefox on the Mac); or b) neither journal has a lot of public tags that I can see, so it may be that it's only going weird when you can see more tags than I'm able to see.

    Just because I can't see it happening doesn't mean we can't figure it out, though! It means you have to do some of the legwork, though, sorry.

    1. Tell me what browser you're using.
    2. Find a friend who can see most of your tags and is using Firefox to take a look and find out if they see the problem.
    3. If you have another account you can log into, switch to that account, make sure you *don't* have that account friended by ainabarad, and check to see if the problem is still there when fewer tags are visible to you.

    And the most important:
    4. Give me a screenshot of the problem and also the html source of the page. You can email me the files -- verymurklins at gmail dot com.

    Reply

    ainabarad January 30 2008, 03:07:37 UTC
    1) Firefox with Windows XP Home Edition.
    2) I added you so you can see most now as my online time is very limited right now due to a storm. The beginning of the "~ misc" tag is huge from what I can see, but it only happens on the tags page, not the other pages: http://ainabarad.livejournal.com/tag
    3) I'll have to try that and see what else I can figure out tomorrow. The storm is really bad right now and I have some other things I need to do tonight (we stay up late).
    4) I shall do that right now so you'll get it in your inbox shortly! :)

    Reply

    Re: HALT! ainabarad March 18 2008, 20:38:56 UTC
    I'm sorry to bug you again. I just thought I'd ask in case it's easy... Is there an easy way to make the tag numbers be aligned to the right instead of being directly after the tags? It just dawned on me that the tag list might be more reader friendly if so. Thank you so much for everything! Even if ya don't get around to helping with this! :D

    Reply

    Re: HALT! murklinstest March 28 2008, 22:30:28 UTC
    Sorry to take so long to respond -- busy week! You can try doing the following to get right aligned tags, but it requires messing about with floated divs, so I'm not sure how well it will display on various browsers. Floats I always find tricky.

    Anyway, find these two pieces of code, and change the blue lines to match what's below.

    # mt:20050623
    # If we're on a tag's last tier, we need to return a link to the tag,
    # otherwise plain text is returned.
    if (size $tags == ($pos + 1))
    {
    # mt:20050817
    # Include the tag count and surround each list item with additional div for styling purposes.
    # mt:20071231
    # Show total count to journal owner, public + friends count to friends, and public-only to everyone else.
    var int uses = $t.security_counts{"public"};
    if (viewer_is_friend()) {
    $uses = $uses + $t.security_counts{"friends"};
    }
    if (viewer_is_owner()) {
    $uses = $t.use_count;
    }
    var string tc = " [" + $uses + "]";
    $tier_code = """

    $tc $tier""";
    }

    # mt:20050818
    # Build the catchall list.
    $catchall_list = "";
    foreach var TagDetail t ($catchall)
    {
    # mt:20071231
    # Show total count to journal owner, public + friends count to friends, and public-only to everyone else.
    var int uses = $t.security_counts{"public"};
    if (viewer_is_friend()) {
    $uses = $uses + $t.security_counts{"friends"};
    }
    if (viewer_is_owner()) {
    $uses = $t.use_count;
    }
    var string tc = " [" + $uses + "]";
    $catchall_list = $catchall_list + """


  • $tc $t.name
  • """;
    }
    Then you need to add in some CSS to do the alignment:

    ul.tagList ul {width: 100%;}
    ul.tagList, li.tagItem {
    margin-right:0;
    padding-right: 0;
    }
    .tagLevel0, .tagLevel1, .tagLevel2. .tagLevel3 {
    clear: both;
    margin-right: 0;
    padding-right: 0;
    }
    .tagCount {
    float: right;
    }
    Give it a shot! I do not guarantee that it will work. :)

    Reply


    Leave a comment

    Up