Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [Jag] Cool "rate" system...

Quote Reply
Re: [Jag] Cool "rate" system... In reply to
Hi,

<G>

Ok, heres a little tutorial on how to do it (assuming your using luna, or similar);

1) Open up luna.css, and add;

Code:

/* styles for the star rater */
.star-rating{
list-style:none;
margin: 0px;
padding:0px;
width: 100px;
height: 20px;
position: relative;
background: url(./images/star_rating.gif) top left repeat-x;
}
.star-rating li{
padding:0px;
margin:0px;
/*\*/
float: left;
/* */
}
.star-rating li a{
display:block;
width:20px;
height: 20px;
text-decoration: none;
text-indent: -9000px;
z-index: 20;
position: absolute;
padding: 0px;
}
.star-rating li a:hover{
background: url(./images/star_rating.gif) left bottom;
z-index: 1;
left: 0px;
}
.star-rating a.one-star{
left: 0px;
}
.star-rating a.one-star:hover{
width:20px;
}
.star-rating a.two-stars{
left:20px;
}
.star-rating a.two-stars:hover{
width: 40px;
}
.star-rating a.three-stars:hover{
width: 60px;
}
.star-rating a.three-stars{
left: 40px;
}
.star-rating a.four-stars{
left: 60px;
}
.star-rating a.four-stars:hover{
width: 80px;
}
.star-rating a.five-stars{
left: 80px;
}
.star-rating a.five-stars:hover{
width: 100px;
}

Then in link.html (or detailed.html, wherever you want the rating code to show), add;

Code:
<ul class='star-rating'>
<li><a href='#' onclick="javascript: do_confirm(2,1,<%ID%>);" title='Rate this 1 star out of 5' class='one-star'>1</a></li>
<li><a href='#' onclick="javascript: do_confirm(4,2,<%ID%>);" title='Rate this 2 stars out of 5' class='two-stars'>2</a></li>
<li><a href='#' onclick="javascript: do_confirm(6,3,<%ID%>);" title='Rate this 3 stars out of 5' class='three-stars'>3</a></li>
<li><a href='#' onclick="javascript: do_confirm(8,4,<%ID%>);" title='Rate this 4 stars out of 5' class='four-stars'>4</a></li>
<li><a href='#' onclick="javascript: do_confirm(10,5,<%ID%>);" title='Rate this 5 stars out of 5' class='five-stars'>5</a></li>
</ul>

...and then at the top of the category.html, add this little bit of javascript code;

Code:
<script>
function do_confirm(Rating,Star,LID) {
if (confirm('Are you sure you want to rate this link a ' + Star + ' star rating?')) window.location = "<%db_cgi_url%>/rate.cgi?ID=" + LID + ";rate=" + Rating;
}
</script>

And last but not least, upload the attached image to /static/luna/.

That should be it Cool

Enjoy!

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread Cool "rate" system... Andy 4929 Oct 21, 2005, 8:18 AM
Thread Re: [Andy] Cool "rate" system...
Jag 4808 Oct 21, 2005, 6:57 PM
Thread Re: [Jag] Cool "rate" system...
Andy 4848 Oct 22, 2005, 1:33 AM
Thread Re: [Andy] Cool "rate" system...
erichcyber 4785 Oct 22, 2005, 12:27 PM
Post Re: [erichcyber] Cool "rate" system...
Andy 4764 Oct 23, 2005, 3:52 AM
Thread Re: [erichcyber] Cool "rate" system...
Jag 4737 Oct 24, 2005, 2:55 PM
Post Re: [Jag] Cool "rate" system...
Evoir 4442 Dec 6, 2006, 1:11 PM