ELSERVER.COMBuscar alt-f
|
Tabla de contenidos |
Spanish wiki users can also get our own spanish version of Ajax Star Rating script, adapted to work on /mediawiki/extensions/Ratings directory.
Create this table on any database.
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;
Download and unpack Ajax rating script into a folder named /extensions/Ratings.
The script's code is not prepared to be invoked from any other directory than where it is placed, so you'll need to adjust some values to make it work on your MediaWiki implementation transparently:
In order to translate the script to other language you'll have to work with: _drawrating.php, js/rating.js, db.php and rpc.php.
Create a file named AjaxRating.php in your /extensions MW directory:
<? # Config $mwRatingsPath = '/mediawiki/extensions/Ratings/'; # Credits $wgExtensionCredits['parserhook'][] = array( 'name'=>'AJAX Rating Script (corrected and really unobtrusive)', 'author'=>'Nicolás Alen - nicolas.alen@elserver.com', 'url'=>'http://www.elserver.com/wiki/MediaWiki_Extension_AJAX_Rating', 'description'=>'Adds .', 'version'=>'0.1.1' ); $wgHooks['ParserBeforeTidy'][] = 'myParserBeforeTidy'; function myParserBeforeTidy(&$parser, &$text ) { global $action, $mwRatingsPath; if ($parser->getTitle()->mNamespace != 0 || $action != "view") return; require_once("Ratings/_drawrating.php"); // Rating HTML ob_start(); ?> <script type="text/javascript" language="javascript" src="<?=$mwRatingsPath?>js/behavior.js"></script> <script type="text/javascript" language="javascript" src="<?=$mwRatingsPath?>js/rating.js"></script> <link rel="stylesheet" type="text/css" href="<?=$mwRatingsPath?>css/rating.css" /> <?=rating_bar($parser->getTitle()->mArticleID,'5','',$mwRatingsPath)?> <? $out = ob_get_contents(); ob_end_clean(); // Append HTML to pre-tidy wiki HTML $text .= $out; } ?>
Change your full path to your MW instalation in:
$mwRatingsPath = '/mediawiki/extensions/Ratings/';
Finally, activate the extension by adding this code in your LocalSettings.php file:
require_once("$IP/extensions/AjaxRating.php");
Esta página fue modificada por última vez el 10:22, 6 jul 2007.
Esta página ha sido visitada 574 veces.