Forum Moderators: coopster

Message Too Old, No Replies

Adding ratings to a page

         

Melter

12:55 pm on Nov 19, 2003 (gmt 0)

10+ Year Member



My site is built on a php content management system and within that I've got a content page that lists authors a-z. I'd like to be able to attach some sort of rating system to this page so ppl can rate each author. Anyone got ideas on how I could do this? If it helps below is a section of the content page code to show how things are set.
<div class="Box5">
<div class="Boxtitle1"> .. <a name="a" id="a">a</a> ..</div>
<div class="Boxcontent">
<a href="authors/n_asher.php">Neal L Asher</a> - writes science fiction<br>
<a href="authors/s_aylett.php">Steve Aylett</a> - writes alternative fiction
<br><br><a href="article.php?1.255">back to top</a></div>
</div>

Thanks.:)

jatar_k

4:34 pm on Nov 19, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



maybe something like this

I assume the authors are stored in a db, if so you can add a "rating" column to the db. It could probably be a float. You can also add a "number of votes" integer column.

You add a link to your rating page, open in same or new window, you pass it the author_id or some other unique identifier for authors. They get the lovely html page where they can select a rating for the author in question.

on submit
select the number of votes and present rating then

dbnumvotes * dbrating + submittedrating / (dbnumvotes + 1) = newrating
insert newrating and dbnumvotes + 1 into db and send them off to a thank you for voting page.

Melter

5:12 pm on Nov 19, 2003 (gmt 0)

10+ Year Member



No the authors aren't part of the db as their pages make use of AWS I didn't need them to be.

I'd like the rating to be directly on the a-z page next to each author's name, i.e. using previous code:


<div class="Box5">
<div class="Boxtitle1"> .. <a name="a" id="a">a</a> ..</div>
<div class="Boxcontent">
<a href="authors/n_asher.php">Neal L Asher</a> - writes science fiction - RATING SYSTEM HERE<br>
<a href="authors/s_aylett.php">Steve Aylett</a> - writes alternative fiction - RATING SYSTEM HERE
<br><br><a href="article.php?1.255">back to top</a></div>
</div>

Melter

5:19 pm on Nov 19, 2003 (gmt 0)

10+ Year Member



Actually thinking about it the author a-z page is part of the db but each author's page isn't.

jatar_k

5:32 pm on Nov 19, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



RATING SYSTEM HERE

yep, you can put it wherever you want, that's just a front end thing. It will still have to make a request to the server (ie. load a new page of some sort) to query db to get, update and store data.

You will have to store data in the db for each author if you want each one to have an individual rating.

You might want to take a look through the data in the db to see what is actually in there for you to use. Then you can understand what needs to be built.