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 = """<tr><td class="meta">[</td> <td class="meta" align="right"><b>$*text_website</b></td> <td class="meta" align="center">|</td> <td class="meta" align="left"><a href="$.journal.website_url">$website_name</a></td> <td class="meta">]</td></tr>"""; } 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 ? "<b>"+lang_viewname($v)+"</b>" : "<a class='index' href='$.view_url{$v}'>"+lang_viewname($v)+"</a>"); } """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n<html>\n<head>\n"""; if ($*external_stylesheet) { println """<link rel="stylesheet" href="$.stylesheet_url" type="text/css" />"""; } else { println """<style type="text/css">"""; print_stylesheet(); "</style>"; } $this->print_head(); """<title>$title</title> </head> <body bgcolor="$*page_back" text="$*entry_text" link="$*page_link" vlink="$*page_vlink" alink="$*page_alink"> <div align="center"> <table width="$*box_width" cellpadding="2" cellspacing="0" border="0" summary=""> <tr><td bgcolor="$*stronger_back" align="center"> <table width="100%" cellpadding="3" cellspacing="0" border="0" summary=""> <tr class="caption"> <td class="caption" align="left"><b>$title</b></td> <td class="index" align="right">[$links]</td> </tr></table> <table width="100%" cellpadding="3" cellspacing="0" border="0" summary=""> <tr> <td class="shadowed" align="center"> <table cellspacing="5" cellpadding="0" border="0" summary="" style="margin-left: auto; margin-right: auto;"> <tr>"""; $this->lay_top_userpic(); var string sitename_lc = $*SITENAMESHORT->lower(); """<td> <div align="center"><b>$.journal.name</b></div><p> <table cellspacing="0" cellpadding="0" border="0" summary=""> $website <tr> <td class="meta">[</td> <td class="meta" align="right"><b>"""+lang_viewname("userinfo")+"""</b></td> <td class="meta" align="center">|</td> <td class="meta" align="left"><a href="$.view_url{"userinfo"}">$sitename_lc userinfo</a></td> <td class="meta">]</td> </tr> <tr> <td class="meta">[</td> <td class="meta" align="right"><b>"""+lang_viewname("archive")+"""</b></td> <td class="meta" align="center">|</td> <td class="meta" align="left"><a href="$.view_url{"archive"}">journal archive</a></td> <td class="meta">]</td> </tr> </table> </td> </tr> </table> </td> </tr></table> </td></tr> </table> """; if (size $.linklist > 0 and $*linklist_support) { $this->print_linklist(); } """ <p> """; $this->print_body(); """ </div> <p> </body> </html> """; }
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:
<a href="http://sm*.sitemeter.com/stats.asp?site=*******" target="_top"> <img
src="http://sm*.sitemeter.com/meter.asp?site=*******" alt="Site Meter" border=0></a>
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:
<td class="meta">]</td> </tr> </table> </td> </tr> </table> <a href="http://sm*.sitemeter.com/stats.asp?site=******" target="_top"> <img src="http://sm*.sitemeter.com/meter.asp?site=******" alt="Site Meter" border=0></a> </td> </tr> </table> </td></tr> </table>
You will need to apply your theme layer via the Customization interface in order for your changes to take effect.
Comments Disabled:
Comments have been disabled for this post.