Ir para conteúdo
Fórum Script Brasil
  • 0

Sistema De Avaliar Produtos Em Sites


saboia2000

Pergunta

Peguei num site toda a implementação para instalar no meu site mas não manjo nada em PHP oque posso fazer:?

(Unobtusive) AJAX Rating Bars v 1.2.2 (March 18 2007)

ryan masuga, ryan@masugadesign.com (http://www.masugadesign.com)

Homepage for this script:

http://www.masugadesign.com/the-lab/script...tar-rating-bar/

=============================================================================

This (Unobtusive) AJAX Rating Bar script is licensed under the

Creative Commons Attribution 3.0 License - http://creativecommons.org/licenses/by/3.0/

What that means is: Use these files however you want, but don't redistribute

without the proper credits, please. I'd appreciate hearing from you if you're

using this script. Credits should include:

- Masuga Design (http://masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/)

- Komodo Media (http://komodomedia.com)

- Climax Designs (http://slim.climaxdesigns.com/).

- Ben Nolan (http://bennolan.com/behaviour/) for Behavio(u)r!

Suggestions or improvements welcome - they only serve to make the script better.

=============================================================================

-----------------------------------------------------------------------------

The necessary files:

PHP Files:

_config-rating.php

_drawrating.php

db.php

rpc.php

CSS File:

rating.css (can mix into your own stylesheet(s))

Javascript files:

behaviour.js

rating.js

Image files:

starrating.gif

working.gif

CHANGELOG:

-----------------------------------------------------------------------------

v 1.2.2 Updates (March 18, 2007):

* ADDED: prefixed DB calls with $rating_dbname for better separation from other scripts

This will really help with Wordpress installs - As of 1.2.2 I don't think

you need to do any special tweaks.

* UPDATED: changed some variable names so as not to confuse with other scripts

-----------------------------------------------------------------------------

v 1.2.1 Updates (March 18, 2007):

* ADDED: a new check to keep voters from faking the vote to something very high

* ADDED: a check to stop people from voting multiple times

* ADDED: example of using 'static' to the Read Me

* UPDATED: Use echo now to render your star rater, because I'm using 'return'

instead of echo in the function

* FIXED: bug where you couldn't have letters in your id. Now, letters and numbers only

* FIXED: issue with number of votes cast (i.e. '0') not showing up for new IDs

-----------------------------------------------------------------------------

v 1.2 Updates (March 11, 2007):

* ADDED: a couple checks to stop possible SQL injection hacks

* ADDED: 'rel="nofollow"' to the rendered rating bar links

* ADDED: Automatic inserting of ID's in the DB

* ADDED: New variables to make it easier to fix your paths!

* ADDED: Ability to call a rater "static" so you can't vote

(Might come in handy if someone needs to be logged in to vote...)

* FIXED: SQL in this readme to use backticks for easier copy-n-paste

* FIXED: modified a couple CSS styles that were giving people headaches

-----------------------------------------------------------------------------

v 1.1 Features:

* Uses unobtrusive Javascript, so ratings will still work if the user has Javascript off

(the script has been tested in IE 6, Safari, and FF).

* keeps Javascript out of the HTML, resulting in cleaner markup

* There are now some checks in place to discourage monkey-business, like negative numbers, or funky IP's

* IP lockout is now in the script

* You can now specify the number of units! If you want 5 stars, just add a 5, otherwise the script defaults to 10.

* Enter database info in one place rather than three places

* This script only uses ONE image

-------------------------------------------------------------

INSTALLATION:

=============================================================================

1. Make your table for the ratings in your db (you should be able to copy

and paste the following SQL)

=============================================================================

CREATE TABLE `ratings` (

`id` varchar(11) NOT NULL,

`total_votes` int(11) NOT NULL default 0,

`total_value` int(11) NOT NULL default 0,

`used_ips` longtext,

PRIMARY KEY (`id`)

) TYPE=MyISAM AUTO_INCREMENT=3;

=============================================================================

2. Enter your specific info into _config-rating.php

=============================================================================

$dbhost = 'localhost';

$dbuser = '###';

$dbpass = '###';

$dbname = '###';

$tableName = 'ratings';

$rating_unitwidth = 30;

=============================================================================

3. Enter this line at the top of any page where you want

to have rating bars.

=============================================================================

<?php require('_drawrating.php'); ?>

=============================================================================

4. Point to the right Javascript and CSS files (you need

behavior.js, rating.js, and rating.css)

=============================================================================

<script type="text/javascript" language="javascript" src="js/behavior.js"></script>

<script type="text/javascript" language="javascript" src="js/rating.js"></script>

<link rel="stylesheet" type="text/css" href="css/rating.css" />

Remember to make sure to fix paths for the images as well. I kept behavior.js separate

from rating.js, because you can use it for other things!

=============================================================================

5. Drop the function wherever you want a rating bar to appear

=============================================================================

NOTE: As of version 1.2.1, use the echo statement! Also, if you use the static

parameter, you should always specify the 2nd parameter (number of units), even if

it is blank (which will default to 10 units)

<?php echo rating_bar('8'); ?> - 10 stars (default), ID of 8

<?php echo rating_bar('8xxa','5'); ?> - 5 stars, ID of 8xxa

<?php echo rating_bar('9a','5','static'); ?> - 5 stars, ID of 9a, static (non votable)

<?php echo rating_bar('9b',''); ?> - 10 stars, ID of 9b

<?php echo rating_bar('9c','8','static'); ?> - 8 stars, ID of 9c, static (non votable)

If you want to change how the rating bar is rendered, you will need to edit

the _drawrating.php file. Also, you might need to edit the bottom of the rpc.php

file at about line 52, where the $newback variable is.

Link para o comentário
Compartilhar em outros sites

5 respostass a esta questão

Posts Recomendados

  • 0
E o que você já fez? Deu algum erro? Que erro?

(Tá tudo explicado no tópico 'instalação')

$dbhost = 'localhost'; Aqui seria o caminho do banco de dados... S:\lojafacil\dados......

$dbuser = '###'; Seria o usuario do banco de dados? e se não tem usuario

$dbpass = '###'; Seria a senha ? e se não tem senha

$dbname = '###'; o nome do banco de dados?

$tableName = 'ratings';

$rating_unitwidth = 30;

Link para o comentário
Compartilhar em outros sites

  • 0

lá onde tá locahost é localhost mesmo... o mysql EXIGE um usuário para a conexão (ou seja, não existe a possbilidade de "e se não tem usuário", senha é a senha (essa pode não existir mesmo), o nome do banco é o que você criar no front-end (geralmente os hosts oferecem o phpmyadmin...

Link para o comentário
Compartilhar em outros sites

  • 0
lá onde tá locahost é localhost mesmo... o mysql EXIGE um usuário para a conexão (ou seja, não existe a possbilidade de "e se não tem usuário", senha é a senha (essa pode não existir mesmo), o nome do banco é o que você criar no front-end (geralmente os hosts oferecem o phpmyadmin...

$rating_dbhost = 'localhost ';

$rating_dbuser = '';

$rating_dbpass = '';

$rating_dbname = 'bdloja_lojavirtual1';

$rating_tableName = 'rating';

$rating_path_db = ''; // the path to your db.php file (not used yet!)

$rating_path_rpc = ''; // the path to your rpc.php file (not used yet!)

Não deu certo Eu tenho um banco de dados em access e criei uma tabela dentro com aquelas informacoes.

criei um HMT assim rodei e não deu certo

<?php require('_drawrating.php'); ?>

<script type="text/javascript" language="javascript" src="js/behavior.js"></script>

<script type="text/javascript" language="javascript" src="js/rating.js"></script>

<link rel="stylesheet" type="text/css" href="css/rating.css" />

<?php echo rating_bar('8'); ?> - 10 stars (default), ID of 8

<?php echo rating_bar('8xxa','5'); ?> - 5 stars, ID of 8xxa

<?php echo rating_bar('9a','5','static'); ?> - 5 stars, ID of 9a, static (non votable)

<?php echo rating_bar('9b',''); ?> - 10 stars, ID of 9b

<?php echo rating_bar('9c','8','static'); ?> - 8 stars, ID of 9c, static (non votable)

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152k
    • Posts
      651,7k
×
×
  • Criar Novo...