kunzite (kunzite1) wrote in component_help,
kunzite
kunzite1
component_help

linklist in scrollbox

in reference to _tumblweed's post. a new pseudo-tutorial.

####################################
#      LINKLIST IN SCROLLBOX       #
# kunzite1, component-help/270309  #
# overrides Page::print_linklist() #
####################################
function Page::print_linklist() {

  var string height = "200px"; # height of component

  var int count     = 0;
  var string return = "";
  var string compBR = """<div class="medLine">"""
                    + """<img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" />"""
                    + """</div>"""
                    + """<div class="ltLine">"""
                    + """<img src="$*SITEROOT/palimg/component/clear.gif" width="1" height="1" alt="" border="0" />"""
                    + """</div>\n""";

  if (size $.linklist <= 0) {
    return;
  } elseif (not $*linklist_support) {
    return;
  }
   
  var bool section_open = false;

  $return = $return + """<div id="Layer1" style="position:relative; height:$height; z-index:1; overflow: auto;">""";
    
  foreach var UserLink l ($.linklist) {
    $count = $count + 1;
    if ($l.title) {
      if ($l.is_heading) {
        if ($section_open) {
          $return = $return + "<br />";
        }
        $return = $return + """<span style="font-weight: bold;">$l.title</span>$compBR""";
        $section_open = true;
      } else {
        $return = $return + """<a href="$l.url">$l.title</a>""";
        if($count < size($.linklist)){
          $return = $return + $compBR;
        }
      }
    }
  }    

  $return = $return + """</div>""";

  """$return""";
}
Tags: !tutorial, *account level: paid/perm, class: page, function: print_linklist, user: kunzite1
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic
  • 59 comments