Extension:Amazon
From MediaWiki.org
|
Amazon Release status: unknown |
|
|---|---|
| Implementation | Tag |
| Description | This (simple) extension could be used for your booksources response page to offer the requested books via Amazon. The extension will output the given Amazon Affiliate Code. |
| Download | see below |
This (simple) extension could be used for your booksources response page to offer the requested books via amazon.
The extension will output the given Amazon Affiliate Code.
[edit] Installation
Create a new file in your extensions folder, named Amazon.php with the following content:
<?php # To activate the extension, include it from your LocalSettings.php # with: include("extensions/Amazon.php"); $wgExtensionFunctions[] = "wfAmazon"; function wfAmazon() { global $wgParser; $wgParser->setHook( "amazon", "renderAmazon" ); } # The callback function for converting the input text to HTML output function renderAmazon( $input ) { # Your Amazon Partner ID # <<<<< EDIT HERE <<<<< $partner = "EDIT HERE"; # Building the code $output = "<iframe src='http://rcm-de.amazon.de/e/cm?t=$partner&o=3&p=8&l=as1&asins=$input&fc1=000000&IS2=1<1=_blank&lc1=0000ff&bc1=000000&bg1=ffffff&f=ifr' style='width:120px;height:240px;' scrolling='no' marginwidth='0' marginheight='0' frameborder='0'></iframe>"; return $output; }
Give your Amazon Affiliate Partner ID to the variable $partner ("EDIT HERE").
If you want to use other code than this, replace it, but remember to replace your partner id in the amazon code with the variable $partner and most important replace the ISBN (ASIN) with the variable $input.
Open your LocalSettings.php, and insert at the end of file:
require_once ("extensions/Amazon.php");
You can then create a page Project:Booksources (The Booksources must be replaces with the translated word of your site language; "Buchhandlungen" for example in german MediaWikis) with the following content:
{{MediaWiki:Booksourcetext}}
<amazon>MAGICNUMBER</amazon>
[edit] Usage
Afterwards the call to Special:Booksources/ISBNNUMBER will end up to the above mentioned page with same layout as the original but displaying your Amazon affilate code.

