Paid Accounts OnlyThe 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 override the Page::print() function in the Generator style. This override will be placed in a theme layer. If you already have one of these for your style, just go to edit it. If you wish to use a non-default theme, you should select one before following the rest of this tutorial. If not, you will need to create one by following the instructions in the
Theme Layer tutorial.
You will need to copy the function Page::print () to your theme layer. At the
Public Layers page, select Generator. Click "Raw Source Code" when viewing a style to download the S2 source. Then locate and copy all of the Page::print () into the layer edit window for your theme layer. This function will be like the following code:
function Page::print ()
{
var string title = $this->title();
var string website_name = $.journal.website_name ? $.journal.website_name : $*text_website_default_name;
var string website;
if ($.journal.website_url != "") {
$website = """[
$*text_website
|
$website_name
]""";
}
var string links;
var bool firstlink = true;
foreach var string v ($.views_order) {
if ($firstlink == false) {
$links = "$links|";
}
else {
$firstlink = false;
}
$links = $links + ($.view == $v ?
""+lang_viewname($v)+"" :
"
"+lang_viewname($v)+"");
}
"""\n\n\n""";
if ($*external_stylesheet) {
println """""";
} else {
println """";
}
$this->print_head();
"""$title
$title
[$links]
""";
$this->lay_top_userpic();
var string sitename_lc = $*SITENAMESHORT->lower();
"""
$.journal.name
$website
[
"""+lang_viewname("userinfo")+"""
|
$sitename_lc userinfo
]
[
"""+lang_viewname("archive")+"""
|
journal archive
]
""";
if (size $.linklist > 0 and $*linklist_support) {
$this->print_linklist();
}
"""
""";
$this->print_body();
"""
""";
}
Inside this code, you are going to insert the HTML for a counter. You can use any counter that does not use JavaScript or server-side-scripting to do its tracking.
Another tutorial has information on counters in general. Specifically, the bottom of the post has information on where to find counters on the internet.
The following is an example of sample Sitemeter code:
src="http://sm*.sitemeter.com/meter.asp?site=*******" alt="Site Meter" border=0>
Now that you have this code, you can insert it anywhere in the above function you want to. Simply copy paste the counter code into some part of the above function. For example, to put this code directly below the default userpicture and navigation links, the bottom of the function above would read:
]
You will need to apply your theme layer via the
Customization interface in order for your changes to take effect.
Originally posted by
crschmidt, rewritten by
aajwind.