kunzite (kunzite1) wrote in component_help,
kunzite
kunzite1
component_help

how to put metadata in a box

if you dont have corner_color defined in your print_entry function, you need to add these to the top of print_entry
  var Color  header        = $*header_bgcolor;
  var Color  headerMinus5  = $header->darker(50);
  var Color  headerPlus3   = $header->lighter(30);
  var Color  ltLineColor   = $*header_bgcolor->lighter(30);
  var Color  dkLineColor   = $*header_bgcolor->darker(50);
  var string ltLineString  = $ltLineColor.as_string;
  var string medLineString = $*header_bgcolor.as_string;
  var string dkLineString  = $dkLineColor.as_string;
  var string corner_color  = "/p0"+$headerPlus3->substr(1,6)+"1"+$headerMinus5->substr(1,6)+"2"+$header->substr(1,6);
once youve done that, we need variables for the box. i am using a modified version of the flatbox.
  var string k1_flatbox_open  = """<tr><td colspan=7><table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td valign="top" rowspan="3" colspan="3" width="5"><img src="$*PALIMGROOT/component/curve-top-left.gif$corner_color" width="5" height="5" alt="" border="0" /></td><td class="dkLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td valign="top" rowspan="3" colspan="3" width="5"><img src="$*PALIMGROOT/component/curve-top-right.gif$corner_color" width="5" height="5" alt="" border="0" /></td></tr><tr><td class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="tabBg"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td></tr><tr><td class="dkLine" width="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="ltLine" width="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="tabBg" width="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td class="tabBg" width="100%"><div align="center" class="compFont">""";
  var string k1_flatbox_close = """</div><td class="tabBg" width="3"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td class="ltLine" width="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td><td class="dkLine" width="1"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td valign="top" rowspan="3" colspan="3" width="5"><img src="$*PALIMGROOT/component/curve-bottom-left.gif$corner_color" width="5" height="5" alt="" border="0" /></td><td class="tabBg"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td><td valign="top" rowspan="3" colspan="3" width="5"><img src="$*PALIMGROOT/component/curve-bottom-right.gif$corner_color" width="5" height="5" alt="" border="0" /></td></tr><tr><td class="ltLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr><tr><td class="dkLine"><img src="$*PALIMGROOT/component/clear.gif" width="1" height="1" alt="" border="0" /></td></tr></table></td></tr><tr><td colspan=5><img src="$*PALIMGROOT/component/clear.gif" width="1" height="3" alt="" border="0" /></td></tr>""";
now we play with the metadata... remove the red and add the green:
  # 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, followed by a mood icon if one exists, followed by the mood text.
    # If you want the mood icon to be after the mood text, then you need to change the order of the two lines in red.

if($e.metadata{"mood"} or $e.metadata{"music"}) {
"""<table>$k1_flatbox_open""";
  # If we have a mood to print
  if ($e.metadata{"mood"}!="") { 
    """<b> $*text_meta_mood : </b>"""; 
    if (defined $e.mood_icon) { """ $e.mood_icon """; }
    print $e.metadata{"mood"}; 
    """<br/>""";
    # 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/>"""; }
    # then print the actual music label and the music
    """<b> $*text_meta_music : </b>"""; print $e.metadata{"music"};
    # """<br/><br/>""";
  }
"""$k1_flatbox_close</table>""";
}
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 23 comments