SimplePortal

Customization => Custom Coding => Topic started by: samborabora on September 21, 2013, 05:27:19 PM

Title: Recent Posts Block show Board Icons?
Post by: samborabora on September 21, 2013, 05:27:19 PM
Hi there, I'm using SP to display an integrated recent posts block on my forum index, I also have custom board icons, so each board has an icon assigned to it. I want the recent posts block to display the board icon, followed by the post title, poster, and I want to remove the time of post. What would the correct code be to change this, and which files should I edit to do so?
Title: Re: Recent Posts Block show Board Icons?
Post by: [SiNaN] on September 25, 2013, 12:04:43 PM
Welcome to SimplePortal!

To remove the poster time:

PortalBlocks.php

Code: (Find and Remove) [Select]
<br />', $item['time'], '
I don't really know how you have those custom board icons but I think it uses the board id to display the correct image. So I can show you how to get the board id and you can use it with the correct path to the custom images:

PortalBlocks.php

Code: (Find) [Select]
', sp_embed_image(empty($parameters['type']) ? 'post' : 'topic'), '
Code: (Replace) [Select]
', $item['board']['id'], '
Title: Re: Recent Posts Block show Board Icons?
Post by: samborabora on September 25, 2013, 07:07:46 PM
Thanks for the help so far, here was the code I modified to get the times to disappear from Recent Topics:

Code: [Select]
echo '
<a href="', $item['href'], '">', $item['subject'], '</a> <span class="smalltext">', $txt['by'], ' ', $item['poster']['link'], $item['new'] ? '' : ' <a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' . $item['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['lang_images_url'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>', '</span><br />', empty($item['is_last']) ? '' : '';

As you see I've taken the time out from there. I'm not sure exactly what to do with the code for the icons, here is the install file for the custom board icons if this helps?

Code: [Select]
// If SSI.php is in the same place as this file, and SMF isn't defined...
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
  require_once(dirname(__FILE__) . '/SSI.php');
// Hmm... no SSI.php and no SMF?
elseif (!defined('SMF'))
  die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');

if((SMF == 'SSI') && !$user_info['is_admin'])
    die('Admin priveleges required.');

// columns to add in SMF boards table
$columns_boards = array();
$columns_boards[] = array(
'table' => '{db_prefix}boards',
'info' => array(
'name' => 'img_new',
'type' => 'varchar',
'size' => 255,
'null' => false,
'default' => '',
),
);

$columns_boards[] = array(
'table' => '{db_prefix}boards',
'info' => array(
'name' => 'img_new_type',
'type' => 'tinyint',
'size' => 1,
'null' => false,
'default' => 0,
'unsigned' => true,
),
);

$columns_boards[] = array(
'table' => '{db_prefix}boards',
'info' => array(
'name' => 'img_old',
'type' => 'varchar',
'size' => 255,
'null' => false,
'default' => '',
),
);

$columns_boards[] = array(
'table' => '{db_prefix}boards',
'info' => array(
'name' => 'img_old_type',
'type' => 'tinyint',
'size' => 1,
'null' => false,
'default' => 0,
'unsigned' => true,
),
);

$columns_boards[] = array(
'table' => '{db_prefix}boards',
'info' => array(
'name' => 'img_redirect',
'type' => 'varchar',
'size' => 255,
'null' => false,
'default' => '',
),
);

$columns_boards[] = array(
'table' => '{db_prefix}boards',
'info' => array(
'name' => 'img_redirect_type',
'type' => 'tinyint',
'size' => 1,
'null' => false,
'default' => 0,
'unsigned' => true,
),
);

db_extend('packages');

if (!empty($columns_boards))
foreach ($columns_boards as $column)
$smcFunc['db_add_column']($column['table'], $column['info'], array(), 'ignore');

?>

Can you work out from that what code I should use to display the relative board icon for each line displayed of the recent topics?
SimplePortal 2.3.8 © 2008-2024, SimplePortal