Log in

No account? Create an account

The S2 HowTo Journal

Tips, Tricks, and Tutorials for Basic S2 Customization

Previous Entry Share Flag Next Entry
[paidaccount][punquin elegant] Adding a tag list to the sidebar
howto_user wrote in s2howto
Paid Accounts Only
The following tutorial requires creating and editing a custom theme layer, which in turn requires a paid, permanent, or early adopter account. Please read What are the paid account benefits? and How do I buy a paid account? to learn about the paid account benefits and how to buy a paid account.

This tutorial requires the creation of a theme layer. If you already have a theme layer, you will need to edit it and add the code below. If you do not have a theme layer, you will need to create one by following the instructions in the Theme Layer tutorial.

The code below will add a tag list to the sidebar in all other views except the friends view. If you would like to see your tag list also on your friends page, leave out the text highlighted in yellow. If your theme layer or layout already has code to print the sidebar, modify it to include the code highlighted in orange.

Otherwise, add the whole following code to your theme layer:

function print_sidebar(Page p) {
    var string title = $p->title();
    var string userpic;
    var Image up_img = $p.journal.default_pic;
    if (defined $up_img) {
        $userpic = """<p align="center"><img border="0" src="$up_img.url"
           height="$up_img.height" width="$up_img.width" alt="" /></p>""";

    var string website_name = $p.journal.website_name ? $p.journal.website_name :
    var string website;
    if ($p.journal.website_url != "") {
        $website = """> <a href="$p.journal.website_url">$website_name
                      </a><br />""";

    var string links;
    foreach var string v ($p.views_order) {
        $links = "$links> " + ($p.view == $v ?
                      lang_viewname($v) :
                      "<a href='$p.view_url{$v}'>"+lang_viewname($v)
                      +"</a>") + "<br />\n";

    # Table Wrapper
    "<!-- Begin Main Sidebar -->\n<td valign='top' align='$*sidebar_position'>";
    "<table width='150' class='standard' cellpadding='5' cellspacing='0'>\n";
    "<tr valign='top'><td align='left'>";

    # Title
    "<div style='text-align:center'><span style='color: $*title_color'>


    # Links

    # Userpic
    "</p>"; if($userpic != "") { "<div style='text-align:center'>$userpic
                      </div>"; }

    # Link List
    if (size $p.linklist > 0 and $*linklist_support) {
        if (not $p.linklist[0].is_heading) {
            "<b>Links:</b><br />";

# Tag List var TagDetail[] visibletags = $p->visible_tag_list(); if (size($visibletags) != 0 and $p.view != "friends") { "<br /><b>Tags:</b><br />"; foreach var TagDetail t ($visibletags) { """<a href="$t.url">$t.name</a><br />"""; } }
# End Table "</td></tr></table>\n<!-- End Main Sidebar -->"; }

Compile your layer, and it's ready to use. You will need to apply your theme layer via the Customize interface in order for your changes to take effect.

Contributed by tell_me.

Comments Disabled:

Comments have been disabled for this post.