News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Problems adding a category style bar on the index template

Started by Krip, March 23, 2010, 12:12:50 PM

Previous topic - Next topic

Krip

Hi guys,

I'm a complete newbie at editing the code, however I'm using Soms script to pull the latest gallery photos to my home page so I added the function, but added a few lines to try a build a title or category bar, the code is as follows but it puts it in the wrong place...

function show_aeva_media_block()
{
   global $sourcedir, $settings, $options, $txt;
   
   // Start with the title bar

   echo '
<div class="roundframe"><div class="innerframe">
<h3 class="catbg"><span class="left"></span>
<img class="icon" id="upshrink_ic" src="', $settings['images_url'], '/collapse.gif" alt="*" title="', $txt['upshrink_description'], '" style="display: none;" />
Latest Media Gallery Uploads
</h3>
<div id="upshrinkHeaderIC"', empty($options['collapse_header_ic']) ? '' : ' style="display: none;"', '>';

   // Set amount visible
   $visible = 3;

   // Load the language file
   loadLanguage('Aeva');

   // Grab the file.
   if (file_exists($sourcedir . '/Aeva-Subs.php'))
      require_once($sourcedir . '/Aeva-Subs.php');

   // If it doesn't exist, tell them this and stop running.
   else
   {
      echo '<b>You don\'t have Aeva installed! Unable to continue!</b>';
      return;
   }

   // Use aeva functions to show the media.
   echo aeva_listItems(aeva_getMediaItems(0, 3, 'm.id_media DESC'), false, '', 0);

   echo '
      <div id="aeva_pics" style="width: 100%;" overflow="visible">
         <div align="center">'. $images. '</div>
      </div>';
}


The bit before //Set amount visable I've added to try and get a bar, the call for the function I put before the call for the info pane so it looks like this...

  show_aeva_media_block();
 
template_info_center();


Unfortunately the results look like so...



Image

Can anyone help as I'd also like to be able to put the thumbnails at the top of the board below the shoutbox, but again with a title or category bar.

Many thanks...


Andy.

Mick.

Ooops nevermind my post....


try this....

 
echo'
<h3 class="titlebg"><span class="left"></span>Latest Media Gallery Uploads</h3><br />';
global $sourcedir;
   // Load the language file
   loadLanguage('Aeva');
   // Grab the file.
   if (file_exists($sourcedir . '/Aeva-Subs.php'));
   // If it doesn't exist, tell them this and stop running.
   else
   {
      echo '<b>You don\'t have Aeva installed! Unable to continue!</b>';
      return;
   }
   // Use aeva functions to show the media.
   echo aeva_listItems(aeva_getMediaItems(0, 5, 'm.id_media DESC'), false, '', 0);

Mick.


Krip

Thanks BlueDevil, just thinking, that removes the ability to collapse the images which would be useful.  The way I had it the entire info pane collapsed also!

Cheers,
Andy.

Mick.

So this code bit worked for you then?

echo'
<h3 class="titlebg"><span class="left"></span>Latest Media Gallery Uploads</h3><br />';

Krip

Actually no, just tried and it looks the same, although using your full code above has also made the pics and board info vanish...

Mick.

Sorry about that......we're using 2 differnt Aeva versions...

Try this at a blind....

function show_aeva_media_block()
{
   global $sourcedir, $settings, $options, $txt;
   
   // Start with the title bar

   echo'
<h3 class="titlebg"><span class="left"></span>Latest Media Gallery Uploads</h3><br />
         <img class="icon" id="upshrink_ic" src="', $settings['images_url'], '/collapse.gif" alt="*" title="', $txt['upshrink_description'], '" style="display: none;" />
    <div id="upshrinkHeaderIC"', empty($options['collapse_header_ic']) ? '' : ' style="display: none;"', '>';

   // Set amount visible
   $visible = 3;

   // Load the language file
   loadLanguage('Aeva');

   // Grab the file.
   if (file_exists($sourcedir . '/Aeva-Subs.php'))
      require_once($sourcedir . '/Aeva-Subs.php');

   // If it doesn't exist, tell them this and stop running.
   else
   {
      echo '<b>You don\'t have Aeva installed! Unable to continue!</b>';
      return;
   }

   // Use aeva functions to show the media.
   echo aeva_listItems(aeva_getMediaItems(0, 3, 'm.id_media DESC'), false, '', 0);

   echo '
      <div id="aeva_pics" style="width: 100%;" overflow="visible">
         <div align="center">'. $images. '</div>
      </div>';
}

Krip

I've tried code similar to yours above:


function show_aeva_media_block()
{
   global $sourcedir;
   
   // Start with the title bar

   echo '
<h3 class="titlebg"><span class="left"></span>Latest Media Gallery Uploads</h3><br />';

   // Load the language file
   loadLanguage('Aeva');

   // Grab the file.
   if (file_exists($sourcedir . '/Aeva-Subs.php'))
      require_once($sourcedir . '/Aeva-Subs.php');

   // If it doesn't exist, tell them this and stop running.
   else
   {
      echo '<b>You don\'t have Aeva installed! Unable to continue!</b>';
      return;
   }

   // Use aeva functions to show the media.
   echo aeva_listItems(aeva_getMediaItems(0, 3, 'm.id_media DESC'), false, '', 0);

   echo '
      <div id="aeva_pics" style="width: 100%;" overflow="visible">
         <div align="center">'. $images. '</div>
      </div>';
}


but it's still not dropping down so the result is:



The bar is the wrong colour but guess i just need to change the class to "catbg" ?


Cheers...

Mick.

It may need an extra /div

try this:

function show_aeva_media_block()
{
   global $sourcedir;
   
   // Start with the title bar

   echo '
</div>
    <h3 class="titlebg"><span class="left"></span>Latest Media Gallery Uploads</h3><br />';

   // Load the language file
   loadLanguage('Aeva');

   // Grab the file.
   if (file_exists($sourcedir . '/Aeva-Subs.php'))
      require_once($sourcedir . '/Aeva-Subs.php');

   // If it doesn't exist, tell them this and stop running.
   else
   {
      echo '<b>You don\'t have Aeva installed! Unable to continue!</b>';
      return;
   }

   // Use aeva functions to show the media.
   echo aeva_listItems(aeva_getMediaItems(0, 3, 'm.id_media DESC'), false, '', 0);

   echo '
      <div id="aeva_pics" style="width: 100%;" overflow="visible">
         <div align="center">'. $images. '</div>
      </div>';
}

Krip

Thanks for the help my friend but still no joy, just the same... also it appears to be putting extra graphics above and below the board info.  You can see a pale blue band above the info catagory header.




Andy

Mick.

Where in the boardindex.php are you adding this?

after?

echo '
<div id="posting_icons" class="flow_hidden">
<ul class="reset">
<li class="align_left"><img src="', $settings['images_url'], '/new_none.png" alt="" /> ', $txt['old_posts'], '</li>
<li class="align_left"><img src="', $settings['images_url'], '/new_redirect.png" alt="" /> ', $txt['redirect_board'], '</li>
</ul>
</div>';


Mick.

Nevermind..... i see where youre adding this...

left me find the correct place..

Krip


Krip

The function is add the bottom of the page, and the call is inside the bottom of the main body function above the info_center call.

Mick.

Wow....this really bit me.  No matter where i put code it still shows in the wrong place.


Have you considered the simpleportal mod?  You can add blocks top and bottom of the forum.  You dont have to have a front page....setting it to forum only should work.

Krip


Mick.

Quote from: Krip on March 23, 2010, 02:27:40 PM
Would it let me put it above the info center? 

Yes.....

Just get rid of the catbg code and the collapsible code too as the block has those function already by default.


Checkout my forum...
http://www.chevyavalancheclub.com/index.php?action=forum

I dont use the collapsible feature tho'.

Krip

I'll give that a go, thanks loats :)

It's a weird one though isn't it... If I use the following code it looks nicer, but it's a bit messy as it's all enclosed in with the info and stats (I've left before and after the function in so you can see where everything is placed...

}
  show_aeva_media_block();
template_info_center();
}

function show_aeva_media_block()
{
   global $sourcedir, $settings, $options, $txt;
   
   // Start with the title bar

   echo '
<span class="clear upperframe"><span></span></span>
<div class="roundframe"><div class="innerframe">
<h3 class="catbg"><span class="left"></span>
<img class="icon" id="upshrink_ic" src="', $settings['images_url'], '/collapse.gif" alt="*" title="', $txt['upshrink_description'], '" style="display: none;" />
Latest Media Gallery Uploads
</h3>
<div id="upshrinkHeaderIC"', empty($options['collapse_header_ic']) ? '' : ' style="display: none;"', '>';

   // Load the language file
   loadLanguage('Aeva');

   // Grab the file.
   if (file_exists($sourcedir . '/Aeva-Subs.php'))
      require_once($sourcedir . '/Aeva-Subs.php');

   // If it doesn't exist, tell them this and stop running.
   else
   {
      echo '<b>You don\'t have Aeva installed! Unable to continue!</b>';
      return;
   }

   // Use aeva functions to show the media.
   echo aeva_listItems(aeva_getMediaItems(0, 3, 'm.id_media DESC'), false, '', 0);

   echo '
      <div id="aeva_pics" style="width: 100%;" overflow="visible">
         <div align="center">'. $images. '</div>
      </div>';
}

function template_info_center()
{




Not sure if that gives any clues, but may as well use Simple Portal if it does what I need :)

Cheers,
Andy.

Mick.

Does that work for you?  It looks good.

I personally rather use the portal so i dont have to edit the boardindex.php everytime i want to make a change.

Krip

Just went to install SP 2.3.1 and it's giving a Test Failed for 'Replace ./Sources/Admin.php', number 1 of 3, the other 2 replacements are ok, weird.

Cheers,
Andy.

Advertisement: