GeeklogWorks.com Rating System (c) 2004

Geeklog Hosting, Setup, Mods, and more www.geeklogworks.com


INTRODUCTION

This simply adds a rating system to Geeklog for stories. It can be modified fairly easily for links, comments, and forum posts if desired with a little php knowledge. To install you should have 1.3.x, preferrably the latest Geeklog for the best results and easiest install. It is setup to allow 1 vote per user ip.

EASY INSTALLATION

IMPORTANT STEP: Please log into geeklog admin account before following the instructions below. Your website may be offline temporarily while you install this mod.

1. First upload rating.php and installrating.php to your public_html directory.

2. Next upload the images in this package(rank 1-5) to your public_html/images directory.

3. Open your lib-database.php file normally found at /path/to/geeklog/system/

Add the following lines under the line for $_TABLES['postmodes']

$_TABLES['ratings'] = $_DB_table_prefix . 'ratings';
$_TABLES['rating_records'] = $_DB_table_prefix . 'rating_records';


Upload the new edited lib-database.php to the appropriate directory.

4. Now run installrating.php from your geeklog website.

5. If it is successful two tables will be created for ratings and rating records. Now continue with instructions below.

6. Go to your theme main directory(/path/to/geeklog/public_html/layout/your_theme_name/. I have included files already modified for each theme in the 'themefiles' folder included in this package . Replace each theme's story and featured story files in your layout folder with the ones included in this package. If you have another theme read below how to modify the correct files for those themes not included.

For themes not included in this package...

Look for featuredstorybodytext.thtml and storybodytext.thtml in same directory described above(step 7).
Important Note: Some themes may use featuredstorytext.thtml and storytext.thtml instead so make sure the file includes the phrase {comments_text} in the file before changing it.

Edit those and insert the following code within the table(without the dashes)...

------------------------(don't copy this line)-------------------------
Current Rating: {story_rating}<br>Rate Story:
[<a href="rating.php?rate=1&type=sid&id={sid}">1</a>] &nbsp;
[<a href="rating.php?rate=2&type=sid&id={sid}">2</a>] &nbsp;
[<a href="rating.php?rate=3&type=sid&id={sid}">3</a>] &nbsp;
[<a href="rating.php?rate=4&type=sid&id={sid}">4</a>] &nbsp;
[<a href="rating.php?rate=5&type=sid&id={sid}">5</a>]

------------------------(don't copy this line)-------------------------

Upload the correct files.


7. Open your lib-common.php file in your public_html directory.

lib-common.php

Look for the line

if( $index == 'n' )

Put the following code above that line

//If an article there is no sid so look for appropriate variable
if($story != ""){
$gstory=$story;
}else{
$gstory=$A[sid];
}
$ratingrecords = DB_query("SELECT * FROM $_TABLES[ratings] WHERE type='sid' AND id = $gstory");
//See if record exists
if(DB_Numrows($ratingrecords) > 0){
while($row = DB_fetchArray($ratingrecords)){
$rated = '<IMG ALIGN=absmiddle SRC='.$_CONF['site_url'].'/images/rank'.$row['rate'].'.gif'.'>';
}
}else{
$rated="No Votes";
}
$article->set_var( 'sid', $A[sid]);
$article->set_var( 'story_rating', $rated);

Save the file and upload it to your public_html directory.


8. That's it! You now have ratings installed and can begin to rate items for your website. Be on the look out for additions by visiting geeklog.net or geeklogworks.com. Thanks!

SUPPORT

For support for this hack please visit
geeklog.net forums. You can also try visiting geeklogworks.com for more information on this project. Thanks.