Tags List & Redirector

Sep 19, 2005 03:21

Note: Do not bother commenting on this post to ask for help. I will not respond. Make a new post instead.
This will add a component with a dropdown box containing tags on all of the entries a viewer has access to on your journal with the ability to select a tag and view all entries tagged with it.

This code will need to go within a component function, such as print_free_text(Page p).

############################################
# LiveJournal Tags List and Redirector #
# by lj:kunzite1, posted by lj:xtomxfallsx #
############################################

var string k1TRheader = "Tags In This Journal"; # set the component header text, you can change this to whatever you want
var string k1TRbutton = "Go"; # button text, change it to whatever you want
var bool k1TRblank = true; # set to true to create a blank option at top the list, or false not to
# No need to change anything below this line (unless you know what you are doing!)

var string k1TRbase_url = $p.journal->base_url();
var string k1TRcontent = "";
var TagDetail[] k1TRtags = $p->visible_tag_list();

foreach var TagDetail k1TRtag ($k1TRtags) {
$k1TRcontent = $k1TRcontent + """$k1TRtag.name\n""";
}

print_comp_header($k1TRheader); # print the component header
"""

""";

print_comp_footer(); # print the component footer

A Warning: If you have a lot of tags on your journal, this component can sometimes cause LJ to have trouble displaying your journal style because the code will die if it takes too long to run. Usually a page refresh will remedy the situation. Just be aware.

user: xtomxfallsx, !tutorial, *account level: paid/perm, function: print_free_text

Previous post Next post
Up