[theme] - [flexisquares] - [component-esque linklist]

Nov 12, 2005 12:43

in response to majiklmoon's s2flexisquares post.

# grab linklist function
function print_sidebar_linklist() {

# get page handle (why doesn't it receive this as a parameter?
var Page p = get_page();

# make var for counting links
var int count = 0;

# get size of linklist
var int size = size($p.linklist);

# if we don't have any links, return
if ($size <= 0) {
return;

# else, if they've turned off linklist support, return
} elseif (not $*linklist_support) {
return;
}

# create a blank UserLink object
var UserLink next_link = new UserLink;

# make var for list
var string list = "";

# cycle thru linklist links
foreach var UserLink l ($p.linklist) {

# increment counter
$count++;

# does this link have a title?
if ($l.title) {

# is this link a heading?
if ($l.is_heading) {

# add an sbartitle
  • to the list
    $list = $list + """
  • $l.title
  • """;
    } else {

    # else, not a heading, add an sbaritem
  • to the list and link to the url
    $list = $list + """
  • $l.title
  • """;

    # if we're not on the last one
    if($count < $size) {

    # grab the next link
    $next_link = $p.linklist[$count];

    # if the next link isn't a heading
    if(not ($next_link.is_heading)) {

    # calculate palimg string to append to image i created that emulates the line thingies in component
    var string palimg = "p0" + $*sidebar_header_bgcolor->substr(1, 6) + "1" + $*entry_bgcolor->substr(1, 6);

    # add an li that is 2px high and has a 1px by 2px img in it
    $list = $list + """

  • """;
    }
    }
    }
    }
    }

    # make var for list title
    var string list_title = "";

    # if there's a link title set by the wizard
    if ($*text_sidebar_links != "") {

    # use it
    $list_title = """
  • $*text_sidebar_links
  • """;
    } else {

    # else, don't
    $list_title = "";
    }

    # print sidebar box with title of what we put together above and content of linklist
    print_sidebar_box($list_title, $list);
    }

    layout flexisquares, function print_sidebar_linklist

    Previous post Next post
    Up