[Addon] Amazon Box - display xx rows

Kleine Codeänderungen oder Mini-MODs
Keine Anfragen!!! -- No requests!!!

Moderator: Supporter

[Addon] Amazon Box - display xx rows

Beitragvon AmigaLink » 14. Mär 2005 21:31

Dieses addon fügt der Amazon Box v1.00 von AWSW eine, im ACP, frei konfigurierbare Anzahl von Reihen hinzu.
Code: Alles auswählen
#
#----------[ RUN SQL ]----------------------------------
#
#  Run the following SQL statement to update your phpBB database.
#  You can use phpMyAdmin or a similar tool to run this update.
#
#  IMPORTANT: If you have changed the table prefix from the default of phpBB2,
#  please be sure to replace phpBB2 with your prefix BEFORE running this update.
#

INSERT INTO `phpbb_config` VALUES ('amazonbox_rows', '3');

#
#----------[ OPEN ]-------------------------------------
#

language/lang_english/lang_admin.php

#
#----------[ FIND ]-------------------------------------
#

$lang['AmazonBoxLimit'] = 'Limit';

#
#----------[ BEFORE, ADD ]------------------------------
#

$lang['AmazonBoxRows'] = 'Rows';
$lang['AmazonBoxRows_exp'] = 'Enter the number of displayed rows here.';

#
#----------[ FIND ]-------------------------------------
#

$lang['AmazonBoxLimit_exp'] = 'Enter the number of displayed values here.';
#
#----------[ REPLACE WITH ]-----------------------------
#

$lang['AmazonBoxLimit_exp'] = 'Enter here the number of displayed values per row.';

#
#----------[ OPEN ]-------------------------------------
#

language/lang_german/lang_admin.php

#
#----------[ FIND ]-------------------------------------
#

$lang['AmazonBoxLimit'] = 'Limit';

#
#----------[ BEFORE, ADD ]------------------------------
#

$lang['AmazonBoxRows'] = 'Reihen';
$lang['AmazonBoxRows_exp'] = 'Trage hier die Anzahl der auszugebenden reihen ein.';

#
#----------[ FIND ]-------------------------------------
#

$lang['AmazonBoxLimit_exp'] = 'Trage hier die Anzahl der auszugebenden Werte ein.';

#
#----------[ REPLACE WITH ]-----------------------------
#

$lang['AmazonBoxLimit_exp'] = 'Trage hier die Anzahl der auszugebenden Artikel, pro reihe, ein.';

#
#----------[ OPEN ]-------------------------------------
#

admin/admin_board.php

#
#----------[ FIND ]-------------------------------------
#

'AmazonBox' => $lang['AmazonBox'],

#
#----------[ AFTER, ADD ]-------------------------------
#

'AmazonBoxRows' => $lang['AmazonBoxRows'],
'AmazonBoxRows_exp' => $lang['AmazonBoxRows_exp'],

#
#----------[ FIND ]-------------------------------------
#

"amazonbox_limit" => $new['amazonbox_limit'],

#
#----------[ BEFORE, ADD ]------------------------------
#

"amazonbox_rows" => $new['amazonbox_rows'],

#
#----------[ OPEN ]-------------------------------------
#

templates/subSilver/admin/board_config_body.tpl

#
#----------[ FIND ]-------------------------------------
#

   <tr>
      <td class="row1">{AmazonBox} - {AmazonBoxLimit}:<br><span class="gensmall">{AmazonBoxLimit_exp}</span></td>
      <td class="row2"><input class="post" type="text" name="amazonbox_limit" size="3" maxlength="3" value="{amazonbox_limit}" /></td>
   </tr>

#
#----------[ BEFORE, ADD ]------------------------------
#

   <tr>
      <td class="row1">{AmazonBox} - {AmazonBoxRows}:<br><span class="gensmall">{AmazonBoxRows_exp}</span></td>
      <td class="row2"><input class="post" type="text" name="amazonbox_rows" size="3" maxlength="3" value="{amazonbox_rows}" /></td>
   </tr>

#
#----------[ OPEN ]-------------------------------------
#

includes/page_tail.php

#
#----------[ FIND ]-------------------------------------
#

// AMAZON BOX START
$amazonbox_limit = $board_config['amazonbox_limit'];
    $sql = "SELECT word, replacement FROM " . AMAZONBOX_TABLE . " ORDER BY RAND() LIMIT " . $amazonbox_limit;
    if ( !($result = $db->sql_query($sql)) )
    {
            message_die(GENERAL_ERROR, 'Could not obtain amazonbox information', '', __LINE__, __FILE__, $sql);
    }
    while ($row = $db->sql_fetchrow($result))
    {
    $word = $row['word'];
    $replacement = $row['replacement'];
            $template->assign_block_vars("amazonbox", array(
            'word' => $word,
            'AmazonImg' => $replacement,
            "AmazonLink" => "http://www.amazon.de/exec/obidos/ASIN/" . $replacement . "/" . $board_config['amazonbox_partnerid']
            ));
    }
// AMAZON BOX END

#
#----------[ REPLACE WITH ]-----------------------------
#

// AMAZON BOX START
$amazonbox_rows = $board_config['amazonbox_rows'];
$amazonbox_limit = $board_config['amazonbox_limit'];
$amazontipps = $amazonbox_rows * $amazonbox_limit;

    $sql = "SELECT word, replacement FROM " . AMAZONBOX_TABLE . " ORDER BY RAND() LIMIT " . $amazontipps;
    if ( !($result = $db->sql_query($sql)) )
    {
            message_die(GENERAL_ERROR, 'Could not obtain amazonbox information', '', __LINE__, __FILE__, $sql);
    }
   $amazondata = array();
   while( $row = $db->sql_fetchrow($result) )
   {
      $amazondata[] = $row;
   }
   $tippnr = 0;

for ($i = 0; $i < ($amazonbox_rows); $i++)
{
   $template->assign_block_vars('boxrow', array());

   for ($j = $i; $j < ($i + $amazonbox_limit); $j++)
   {
      if( $tippnr >= count($amazondata) )
      {
         break;
      }
      $word = $amazondata[$tippnr]['word'];
      $replacement = $amazondata[$tippnr]['replacement'];
      $template->assign_block_vars("boxrow.amazonbox", array(
            'word' => $word,
            'AmazonImg' => $replacement,
            "AmazonLink" => "http://www.amazon.de/exec/obidos/ASIN/" . $replacement . "/" . $board_config['amazonbox_partnerid'],
            ));
      $tippnr++;

   }
}

$template->assign_vars(array(
      'amazonbox_limit' => $amazonbox_limit
      ));
// AMAZON BOX END

#
#----------[ OPEN ]-------------------------------------
#

templates/subSilver/overall_footer.tpl

#
#----------[ FIND ]-------------------------------------
#

<!-- ##### AMAZON BOX START ##### -->
<br><center><table border="0" cellpadding="1" cellspacing="1" style="border-collapse: collapse" class="forumline">
  <tr>
        <td class="catHead" colspan="{amazonbox_limit}" height="25"><span class="cattitle"><center><b>{AmazonBox}:</b></center></span></td>
  </tr>
  <tr>
        <td colspan="{amazonbox_limit}" height="1" class="row3"><img src="images/spacer.gif" width="1" height="1" alt="."></td>
  </tr>
  <tr>
  <!-- BEGIN amazonbox -->
      <td class="row1" align="center"><a href="{amazonbox.AmazonLink}" target="_blank" class="gensmall"><img src="images/amazonimages/{amazonbox.AmazonImg}.jpg" title="{amazonbox.word}" border="0"><br>{amazonbox.word}</a></td>
  <!-- END amazonbox -->
  </tr>
</table></center><br>
<!-- ##### AMAZON BOX END ##### -->

#
#----------[ REPLACE WITH ]-----------------------------
#

<!-- ##### AMAZON BOX START ##### -->
<br><center><table border="0" cellpadding="1" cellspacing="1" style="border-collapse: collapse" class="forumline" width="100%">
  <tr>
      <td class="spaceRow" colspan="{amazonbox_limit}" height="1"><img src="images/spacer.gif" width="1" height="1" alt="" title=""></td>
  </tr>
  <!-- BEGIN boxrow -->
  <tr>
  <!-- BEGIN amazonbox -->
      <td class="row1" align="center"><a href="{boxrow.amazonbox.AmazonLink}" target="_blank" class="gensmall"><img src="images/amazonimages/{boxrow.amazonbox.AmazonImg}.jpg" title="{boxrow.amazonbox.word}" border="0"><br>{boxrow.amazonbox.word}</a></td>
  <!-- END amazonbox -->
  </tr>
  <tr>
      <td class="spaceRow" colspan="{amazonbox_limit}" height="1"><img src="images/spacer.gif" width="1" height="1" alt="" title=""></td>
  </tr>
  <!-- END boxrow -->
</table></center><br>
<!-- ##### AMAZON BOX END ##### -->

#
#----------[ SAVE AND CLOSE ALL FILES ]-----------------
#
# EoM
Die deutsche Sprache ist Freeware, du kannst sie benutzen, ohne dafür zu bezahlen. Sie ist aber nicht Open Source, also darfst du sie nicht verändern, wie es dir gerade passt.
Benutzeravatar
AmigaLink
Administrator
 
Beiträge: 3987
Registriert: 11. Aug 2004 01:06
Wohnort: NRW

Zurück zu phpBB2 Snippets



Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 10 Gäste

cron