The S2 HowTo Journal

Tips, Tricks, and Tutorials for Basic S2 Customization

Previous Entry Share Next Entry
[paidaccount][opal] 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 Opal (Libra OSWD). It will override the function Page::lay_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 Opal layout, you can add add a list of your tags in an extra sidebar box, using the code below. Detailed information on adding sidebar boxes in Opal may be found here. Note that if your theme layer already has function Page::lay_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 Page::lay_print_sidebar {
	var string header;
	var string text;

	$this->lay_print_summary();
	$this->print_linklist();
	$this->lay_print_freetext();
	$this->lay_print_calendar();

var TagDetail[] visibletags = $this->visible_tag_list(); if (size($visibletags) != 0 and $.view != "friends") { $header = "Tags"; foreach var TagDetail t ($visibletags) { $text = $text + """<div class="columnitem"><a href="$t.url">$t.name</a></div>"""; } print_box($header, $text); }
}

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 text 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.

Contributed by camomiletea with some elements borrowed from a tutorial by tell_me.


Comments Disabled:

Comments have been disabled for this post.

?

Log in

No account? Create an account