Hallo 4seven,
der Amazon-Mod von buecherseite.de arbeitet vermutlich auch mit der Amazon-API, da bei dem Mod die Seite von buecherseite.de aufgerufen wird. Hier mal die amazon_into_editor.php (nur für
phpBB2 !)
Code: Alles auswählen
[....]
// Please insert here your amazon associates id
// if you have Amazon Associates Id's from different Amazon lands (amazon.com, amazon.fr, etc..)
// plese insert here all ID's you have. by example: $associates_id_from[US] = 'your-partner-id';
$associates_id_from[US] = ''; // please leave empty, if you don't have an id from amazon.com
$associates_id_from[DE] = ''; // please leave empty, if you don't have an id from amazon.de
$associates_id_from[FR] = ''; // please leave empty, if you don't have an id from amazon.fr
$associates_id_from[UK] = ''; // please leave empty, if you don't have an id from amazon.co.uk
$associates_id_from[JP] = ''; // please leave empty, if you don't have an id from amazon.co.jp
$associates_id_from[CA] = ''; // please leave empty, if you don't have an id from amazon.ca
// Please insert here your (Amazon-) country, from where your amazon partner id is from
// if you have Id's from more than one country, please chose a preferred one.
// possible: US, DE, FR, UK, CA, or JP
$land = 'US';
// Your background image:
$background_img = '';
// Your background color:
$background_col = '#FFFFFF';
// from here, no more changes are needed
$u_land = array( 'US'=>'com', 'DE'=>'de', 'JP'=>'co.jp', 'UK'=>'co.uk', 'FR'=>'fr', 'CA'=>'ca');
$partner = array( 'US'=>'newbooks-20', 'DE'=>'s0b-21', 'UK'=>'heremorebooki-21', 'JP'=>'', 'FR'=>'photoinfo-21', 'CA'=>'' );
if (isset($HTTP_GET_VARS['land'])) { $land = substr($HTTP_GET_VARS['land'], 0, 2); }
$associates_id = $associates_id_from[$land];
if ( $associates_id == '' ) { $associates_id = $partner[$land]; }
$ama_url = 'http://www.amazon.' . $u_land[$land] . '/exec/obidos/redirect?tag=' . $associates_id ;
$show_land = 0;
foreach ($associates_id_from as $test) { if ($test!='') { $show_land++; } } // if you want to let the user chose the country in every case, please replace this line by: $show_land = 2 ;
// if you translate it into french or japanese , please tell me, cause there are a few other phrases to translate: http://www.superphotos.info/forum/viewforum.php?f=4
$lang['L_AMAZONIA_formular1'] = 'Book Code Generator';
$lang['L_AMAZONIA_formular2'] = 'Welcome to the books, cd or other amazon products code generator.<br>You will get here the Code for easy creating a link.<br><font size="1">All you have to do is inserting the ISBN or Asin number into the form.</font>';
$lang['L_AMAZONIA_formular3'] = 'Asin or ISBN number';
$lang['L_AMAZONIA_formular4'] = 'If you don't know the products Asin oder ISBN number, please take a look for it at the products detail page at <a href="'.$ama_url.'" target="_blank" title="Please click here for searching your product asin at Amazon. (You will find it at the bottom of the products detail page)"><strong>AMAZON</strong></a> (please simply copy & paste it into the field).';
$lang['L_AMAZONIA_formular15'] = 'Create Code';
$lang['L_AMAZONIA_Asin_not_found_search'] = 'Sorry - We got no data<br>Please check your asin or isbn Number at <a href="'.$ama_url.'" target="_blank" title="Please click here for searching your product asin at Amazon. You will find it at the bottom of the products detail page.">Amazon</a>.';
$lang['L_AMAZONIA_window_close'] = 'close window';
$lang['L_AMAZONIA_server_error'] = 'There seems to be a server problem, please try again later.';
$lang['L_AMAZONIA_amazon_land'] = '';
if($land == 'DE') {
$lang['L_AMAZONIA_formular1'] = 'Bücher Code Generator';
$lang['L_AMAZONIA_formular2'] = 'Willkommen beim Code Generator für Hinweise auf<br>Bücher, CDs oder andere Amazon Produkte.<br><font size="1">Hierzu brauchen Sie lediglich die ISBN oder Asin Nummer einzugeben.</font>';
$lang['L_AMAZONIA_formular3'] = 'Asin oder ISBN Nummer';
$lang['L_AMAZONIA_formular4'] = 'Falls Sie die Asin oder ISBN Nummer nicht kennen, so kopieren Sie diese einfach von der Detail Seite, des jeweiligen <a href="'.$ama_url.'" target="_blank" title="Bitte hier klicken, um bei Amazon nach der Asin oder ISBN Nummer suchen."><strong>Amazon Produktes</strong></a>.';
$lang['L_AMAZONIA_formular15'] = 'Code erzeugen';
$lang['L_AMAZONIA_Asin_not_found_search'] = 'Sorry - Zu Ihrer eingegebenen Asin konnten bei Amazon keine Daten gefunden werden. Bitte überprüfen Sie bei <a href="'.$ama_url.'" target="_blank" title="Bitte hier klicken, um bei Amazon nach der Asin oder ISBN Nummer suchen.">Amazon</a>, ob Ihre Asin oder ISBN Nummer korrekt ist, und bei Amazon angeboten wird.';
$lang['L_AMAZONIA_window_close'] = 'Fenster schließen';
$lang['L_AMAZONIA_server_error'] = 'Ein Server Fehler ist aufgetreten. Bitte probieren Sie es später nocheinmal';
$lang['L_AMAZONIA_amazon_land'] = '';
}
$Asin = trim(str_replace("-","",$HTTP_GET_VARS['Asin'])) ;
// zum testen:if ($Asin=="") { $Asin = '3933556066' ; } // 3548253741 B0000D89UV
if ( !(preg_match('/^[xA-Z0-9]{10,13}$/i', $Asin) ) ) {
if ($Asin!='') { $lang['L_AMAZONIA_formular3'] = $lang['L_AMAZONIA_Asin_not_found_search'].'<br><br>'.$lang['L_AMAZONIA_formular3']; $Asin = '' ; } else { $Asin = '' ; }
} else {
// wenn asin vorhanden, dann file holen
$data = file("http://www.buechersuchseite.de/amazon_code.php?Asin=$Asin&land=$land&partnerId=$associates_id&code=phpbb");
if ($data=="") { echo "<br><br><center>" . $lang['L_AMAZONIA_server_error'] . "</center>"; exit; }
$script_spezial = "function handleSpezial() {
var text = codepart ;
if (opener.document.forms['post'].message.createTextRange && opener.document.forms['post'].message.caretPos) {
var caretPos = opener.document.forms['post'].message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
opener.document.forms['post'].message.focus();
window.close();
} else {
opener.document.forms['post'].message.value += text;
opener.document.forms['post'].message.focus();
window.close();
}
}
";
$suchen = true ;
for($x=0;$x<count($data);$x++){
if((preg_match('/<body/i',$data[$x]))&&($suchen)) {
echo '<body bgcolor="'.$background_col.'" background="'.$background_img.'" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">';
$suchen = false ;
} else {
if((preg_match('/function handleSpezial/i',$data[$x]))&&($suchen)) {
echo $script_spezial ;
} else {
echo $data[$x];
}
}
}
exit; // fertig
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><? echo $lang['L_AMAZONIA_formular1'] ; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="<? echo $background_col ; ?>" background="<? echo $background_img ; ?>" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="100%" border="0" cellpadding="7" cellspacing="0">
<tr>
<td align="center" valign="middle">
<form name="form1" method="GET" action="amazon_into_editor.php">
<table width="424" border="1" cellpadding="0" cellspacing="0" bgcolor="#F8F8F8" style="border-style:groove">
<tr>
<td>
<table width="420" border="0" cellspacing="0" cellpadding="6">
<tr>
<td><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><? echo $lang['L_AMAZONIA_formular2'] ; ?></font><br><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong><br>
</strong>
</font>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="bottom"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<strong><? echo $lang['L_AMAZONIA_formular3'] ; ?></strong><br>
<input name="Asin" type="text" value="<? echo $Asin; ?>" size="24">
</font></td>
<? if ($show_land>1) { ?>
<td align="center" valign="bottom"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong> <? echo $lang['L_AMAZONIA_amazon_land'] ; ?></strong><br>
<select name="land" id="land">
<option value="<? echo $land; ?>">Amazon <? echo $land; ?></option>
<option value="DE">Amazon DE</option>
<option value="FR">Amazon FR</option>
<option value="UK">Amazon UK</option>
<option value="US">Amazon US</option>
<option value="CA">Amazon CA</option>
<option value="JP">Amazon JP</option>
</select>
</font></td>
<? } ?>
</tr>
</table>
<font size="1" face="Verdana, Arial, Helvetica, sans-serif"> <br>
<? echo $lang['L_AMAZONIA_formular4'] ; ?></font></div></td>
</tr>
<tr>
<td align="center" valign="middle">
<input type="submit" name="Submit" value="<? echo $lang['L_AMAZONIA_formular15'] ; ?>">
</td>
</tr>
</table></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td height="22" align="center" valign="middle">
<font size="1" face="Verdana, Arial"><a href="javascript:window.close()" title="Bitte hier klicken, um dieses Fenster zu schließen"><? echo $lang['L_AMAZONIA_window_close'] ; ?></a></font>
</td>
</tr>
</table>
</body>
</html>
Hieran ist deutlich zu sehen, dass die Daten nicht im Mod generiert werden, sondern bei bucherseite.de und ähnlich wie das Javascript von Amazon nur die fertigen Daten übergeben werden.
Code: Alles auswählen
// wenn asin vorhanden, dann file holen
$data = file("http://www.buechersuchseite.de/amazon_code.php?Asin=$Asin&land=$land&partnerId=$associates_id&code=phpbb");
Dann wird noch in die templates/subSilver/posting_body.tpl das hier eingetragen
Code: Alles auswählen
<span class="nav"><a href="amazon_into_editor.php" onclick="window.open('amazon_into_editor.php', '_phpbbsmilies', 'HEIGHT=520,resizable=yes,scrollbars=yes,WIDTH=640');return false;" target="_phpbbamazon" class="nav" title="Füge einen Link zu einem Buch von Amazon mit dem Coverbild in deinen Beitrag ein.">Buchhinweis einfügen</a></span>
Das ist parktisch der ganze Mod, er besteht nur aus der einen php und dem Eintrag in die posting_body.tpl.
Hier mal der Link zu
Amazon Web Services, dort ist es irgendwo beschrieben. Eine Version von 2006 habe ich noch hier bei mir, die könnte ich dir zukommen lassen.
@FatFreddy
Ich finde deinen Mod echt super, das ist fast das was ich gesucht habe. Da läst sich bestimmt auch das Partnerprogramm als BBCode einbauen, damit auch die User in den Beiträgen Bücher nennen können. Ich wollte den Mod eigentlich auch als Literaturverzeichnis für meine neue Homepage nehmen. Wenn ich da nichts passendes finde, dann mache ich es auf die klassische Weise und lade mir die Daten und Bilder von Amazon runter und trage sie in eine Datenbank ein bzw. schreibe sie fest in die Datei.
Gruß Helmut
Ich bin nicht ganz dicht.... na und.