Extension:AjaxRatingScript

Update: Working AJAX Stars. No loading
I have updated this extension as well as provided a download package that already has all the edits need to make these stars actually AJAXed. --Cdpollard 05:02, 3 May 2007 (UTC)

Step 1: Download the script first
Download the AJAX Rating Script package and install it under... extensions/Ratings

Step 2: Create extension
Then create a new file in your extensions directory called RateArticle.php

RateArticle.php
 'AJAX RATING BAR', 'author' => 'Boudewijn Vahrmeijer', 'url' => 'http://www.leerwiki.nl', 'version' => '1.9.3/1.9.2/1.8.2', ); $wgHooks['AfterArticleDisplayed'][] = array("wfRateArticleForm"); function wfRateArticleForm($DIVRATING,$AID) { global $wgArticle, $out; if ($wgArticle == null) return; $URLRIGHTPART= $_SERVER['REQUEST_URI']; if(substr_count($URLRIGHTPART,"Hoofdpagina")==1||substr_count($URLRIGHTPART,"LeerWiki")==1||substr_count($URLRIGHTPART,"action=edit")==1||substr_count($URLRIGHTPART,"Overleg")==1) {		$UITZOND= 1; }	if (isset ($UITZOND ) && $UITZOND != 1){ $DIVRATING=rating_bar($AID,5); }

} ?>

Step 3: Enable it
Simply call the extension from your LocalSettings.php require_once("$IP/extensions/RateArticle.php");

Step 4: Display it
Now in order to make it show in your wiki, You must edit your skin file.

MonoBook.php
Add this after function execute {

You can search for: "} // end of execute method"

global $wgArticle; if ($wgArticle){ $AID=$wgArticle->getID; }

Add this to the end of the head.

  

Put this in where you want it displayed.



Step 5: Core File Edit
Replace in: includes/Skintemplate.php

Skintemplate.php
Replace $tpl->set( 'bottomscripts', $this->bottomScripts ); $printfooter = "\n". $this->printSource. " \n"; $out->mBodytext .= $printfooter ; With $tpl->set( 'bottomscripts', $this->bottomScripts ); //### START RATING ############### if ( $wgOut->isArticle and (!isset( $oldid ) or isset( $diff )) and 0 != $wgArticle->getID ) {	 $AID=$wgArticle->getID; wfRunHooks( 'AfterArticleDisplayed', array( &$DIVRATING,&$AID)); } else { $DIVRATING='';}$printfooter =  $DIVRATING."\n". $this->printSource. " \n"; //#### END RATING ################ $out->mBodytext .= $printfooter ;

Step 6: Finished
Upload all your changes and enjoy enhanced ajax rating on your articles.

Who's using it?
Please add your working-wiki here!
 * inGameDex.com : inGame Encyclopedia
 * Wereldpagina.nl : World-wide travel guide
 * LeerWiki.nl : Success Manuals
 * hobby-planet.de : XBox 360 Wiki (Solutions, etc.)
 * www.ds-xtra.com Homebrew directory for the DS-Xtreme (running custom version)
 * www.newwayswiki.org Progressive Ideas Database
 * wikiknitting.com Knitting Knowledgebase and Free Patterns (running custom version)

How to port Unobtrusive AJAX Star Rating Bar to MediaWiki. Go to: http://www.leerwiki.nl/How_to_port_Unobtrusive_AJAX_Star_Rating_Bar_to_MediaWiki