howto_user (howto_user) wrote in s2howto,

[paidaccount][opal] Adding a tag list to the sidebar

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;


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">$</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.

Tags: - opal, paid accounts only, tag list

Comments for this post were disabled by the author