The S2 HowTo Journal

Tips, Tricks, and Tutorials for Basic S2 Customization

Previous Entry Share Next Entry
[paidaccount][flexible squares] Adding a tag list to the sidebar
howto_user wrote in s2howto
Paid Accounts Only
The following tutorial requires creating and editing a custom style, 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 will explain how to add a tags list to the sidebar in Flexible Squares. It will override the function print_sidebar. This new code will be placed in 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.

In the Flexible Squares layout, you can add add a list of your tags to the bottom of the sidebar box by using the code below. Detailed information on adding sidebar boxes in Flexible Squares may be found here. Note that if your theme layer already has function print_sidebar, you will need to modify it to include the code highlighted in orange. Otherwise, copy and paste the following code into the layer, making sure to include everything:

function print_sidebar()
{
    sidebar_order($*sidebar_order_1);
    sidebar_order($*sidebar_order_2);
    sidebar_order($*sidebar_order_3);
    sidebar_order($*sidebar_order_4);
	
var Page p = get_page(); var TagDetail[] visibletags = $p->visible_tag_list(); if (size($visibletags) != 0 and $p.view != "friends"){ var string tlist_title = """<li class="sbartitle">Tags</li>"""; var string tlist = ""; foreach var TagDetail td ($visibletags) { $tlist = $tlist + """<li class="sbaritem"> <a href="$td.url">$td.name</a></li>"""; } print_sidebar_box($tlist_title, $tlist); }
}

This code will add a tag list to the sidebar in all journal views except the friends view. If you would like to see your tag list also on your friends page, remove the code highlighted in yellow.

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.

Compiled by tell_me. Based on a tutorial written by camomiletea.


Comments Disabled:

Comments have been disabled for this post.

?

Log in

No account? Create an account