SimplePortal

Customization => Custom Coding => Topic started by: gumis_rulez on December 27, 2010, 06:37:24 PM

Title: Re: Blocks In Blocks
Post by: gumis_rulez on December 27, 2010, 06:37:24 PM
I am quite not familiar with this code and I cannot change it in order to meet my expactations. Could someone change the following code in order NOT to have recent topics, posts, calendar but information from chosen category/topic?

Code: [Select]
$blocks = array(
   array(
      'label' => 'Recent Posts',
      'type' => 'sp_recent',
      'parameters' => array('display' => 1),
   ),
   array(
      'label' => 'Recent Topics',
      'type' => 'sp_recent',
      'parameters' => array('type' => 1, 'display' => 1),
   ),
   array(
      'label' => 'Top Posters',
      'type' => 'sp_topPoster',
      'parameters' => array(),
   ),
   array(
      'label' => 'Calendar',
      'type' => 'sp_calendar',
      'parameters' => array(),
   ),
);

global $txt;

$button_list = array();
foreach ($blocks as $id => $block)
{
   $txt['sp_bib_label_' . $id] = $block['label'];

   $button_list[] = array(
      'text' => 'sp_bib_label_' . $id,
      'image' => '',
      'lang' => true,
      'url' => '#sp_bib_' . $id . '" id="sp_bib_button_' . $id . '" onclick="sp_bib_change(' . $id . '); return false;',
   );
}

$button_list[0]['active'] = true;

echo '
<div style="overflow: auto;">
   ', template_button_strip($button_list), '
</div>';

foreach ($blocks as $id => $block)
{
   echo '
<div id="sp_bib_', $id, '"', $id != 0 ? ' style="display: none;"' : '', '>';

   $block['type']($block['parameters'], 0);

   echo '
</div>';
}

echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
   function sp_bib_change(id)
   {
      for (var i = 0; i < ', count($blocks), '; i++)
      {
         document.getElementById(\'sp_bib_\' + i).style.display = i == id ? \'\' : \'none\';
         document.getElementById(\'sp_bib_button_\' + i).className = \'button_strip_\' + i + (i == id ? \' active\' : \'\');
      }
   }
// ]]></script>';
SimplePortal 2.3.8 © 2008-2024, SimplePortal