Zzyzx Wolfe (zzyzx) wrote in component_help,
Zzyzx Wolfe
zzyzx
component_help

  • Mood:

Quick Tag Hack.

Add set tags_aware = true; to your layer and the following where you mood/music/entry are being printed. This isn't a tutorial or anything, but if someone wants to shove it into another one, they're more than welcome. I just thought I'd add this so someone doesn't have to rekludge the code. It's probably horrible, but it'll do, hopefully. If it breaks, tell me. Don't ask me how to put this in your journal, because I'm a lazy bastard.

# Print Mood and/or Music Fields: # If we have a mood to print if ($e.metadata{"mood"}!="") { # first we need a spacer after the entry text """<br/><br/>"""; # and then we print the mood label and the mood """<span class="currents"><b> $*text_meta_mood: </b>"""; if (defined $e.mood_icon) { """ $e.mood_icon """; } print $e.metadata{"mood"}; # followed by the mood icon if one exists. If you don't want the mood icons to show, remove the line below """</span>"""; # if ($e.metadata{"music"}=="") { """<br/>"""; } } # If we have music to print if ($e.metadata{"music"}!="") { # If we didn't print a spacer because the mood was empty, then print one if ($e.metadata{"mood"}=="") { """<br/><br/>"""; } if ($e.metadata{"mood"}!="") { """<br/>"""; } # then print the actual music label and the music """<span class="currents"><b> $*text_meta_music: </b>"""; print $e.metadata{"music"}; """</span>"""; } # If we have tags to print if ($e.tags) { if ($e.metadata{"mood"}=="" and $e.metadata{"music"}=="") { """<br/><br/>"""; } if ($e.metadata{"mood"}!="" or $e.metadata{"music"}!="") { """<br/>"""; } """<span class="currents"><b> <a href="$*SITEROOT/edittags.bml?journal=$e.journal.username&itemid=$e.itemid">Tags</a>: </b>"""; var int tcount = 0; foreach var Tag t ($e.tags) { """<a rel="tag" href="$t.url">$t.name</a>"""; $tcount++; if ($tcount != size $e.tags) { """, """; } } """</span>"""; }