?

Log in

No account? Create an account
 
 
March 19 2007 @ 01:51 pm
Scolling Tag Component  

With all my messing around in components and with a lot of help from component_help... I figured out how to make the Tag Comma List scroll!

 

 

function print_tags(Page p) {

    print_comp_header($*tags_text); #this is controlled by "Tags List Component Title" in the cust wizard; it can also be set by "set tags_text = "Tags";"

    var TagDetail[] tags = $p->visible_tag_list();

    var int tcount = 0;

    foreach var TagDetail td ($tags) {

        $tcount++;

        var string uses = get_plural_phrase($td.use_count, "text_tag_uses");

        var string security = $td.visibility;

        """<a href="$td.url" title="$uses, $security">$td.name</a>""";

        if($tcount < size($tags)) { print ", "; } #change the comma if you want to change the divider between tags

    }

    print_comp_footer();

}

As found here

 

To put this in my list of components it needed to be changed a bit to

 

    print_comp_header($*tags_text); #this is controlled by "Tags List Component Title" in the cust wizard; it can also be set by "set tags_text = "Tags";"

    var TagDetail[] tags = $p->visible_tag_list();

    var int tcount = 0;

    foreach var TagDetail td ($tags) {

        $tcount++;

        var string uses = get_plural_phrase($td.use_count, "text_tag_uses");

        var string security = $td.visibility;

        """<a href="$td.url" title="$uses, $security">$td.name</a>""";

        if($tcount < size($tags)) { print ", "; } #change the comma if you want to change the divider between tags

    }

    print_comp_footer(); 

 

I already had the function going with 

function print_profile(Page p) {

and that the end of all the components I had

}

I wanted to add scrolling because the list was so long (in red)...

 

SCROLLING CODING

 

print_comp_header($*tags_text); #this is controlled by "Tags List Component Title" in the cust wizard; it can also be set by "set tags_text = "Tags";"

"""

<div id="Layer1" style="position:relative; width:185px; height:240px; z-index:1; overflow: auto; overflow-x: hidden;">

""";

    var TagDetail[] tags = $p->visible_tag_list();

    var int tcount = 0;

    foreach var TagDetail td ($tags) {

        $tcount++;

        var string uses = get_plural_phrase($td.use_count, "text_tag_uses");

        var string security = $td.visibility;

        """<a href="$td.url" title="$uses, $security">$td.name</a>""";

        if($tcount < size($tags)) { print ", "; } #change the comma if you want to change the divider between tags

    }

    print_comp_footer();

 

viola... scrolling tag component!