Before you attempt to install this mod for MX-System, you MUST have it installed and working for phpBB. You can have it just working for MX and not phpBB but this tutorial will not cover that procedure.
I had installed the Complete Banner Mod (CBM) for phpBB and everything worked brilliantly. I had a banner being displayed in the overall_header.tpl, I now had to get the CBM working for MX so that the overall_header.tpl files were synchronised.
I am using a different theme to subSilver, so I never made the changes for the template files outlined in the CBM installation instructions, I just used the {BANNER_0_IMG} variable and edited into the required position in the overall_header.tpl, for phpBB & MX where I required it.
Step 1: All banners that you have already uploaded in the CBM admin section of phpBB, now need to be copied from: phpBB folder > images to MX-System folder > images.
Every additional banner that you now add in the CBM admin section of phpBB must then be copied over as above.
Step 2: As you did for phpBB, you now have to do for MX but skipping a few edits, below is each step you will need to make:
- Code: Select all
#
#-----[ OPEN ]------------------------------------------
#
MX directory/includes/constants.php
#
#-----[ FIND ]------------------------------------------
#
define('PAGE_GROUPCP', -11);
#
#-----[ AFTER, ADD ]------------------------------------------
#
define('PAGE_REDIRECT', -1031);
#
#-----[ FIND ]------------------------------------------
#
define('USERS_TABLE', $table_prefix.'users');
#
#-----[ AFTER, ADD ]------------------------------------------
#
define('BANNER_STATS_TABLE', $table_prefix.'banner_stats');
define('BANNERS_TABLE', $table_prefix.'banner');
#
#-----[ OPEN ]------------------------------------------
#
MX directory/includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
//
// The following assigns all _common_ variables that may be used at any point
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$time_now=time();
$hour_now=create_date('Hi',$time_now,$board_config['board_timezone']);
$date_now=create_date('Ymd',$time_now,$board_config['board_timezone']);
$week_now=create_date('w',$time_now,$board_config['board_timezone']);
$sql_level= ($userdata['user_id']==ANONYMOUS) ? ANONYMOUS : (($userdata['user_level']==ADMIN) ? MOD : (($userdata['user_level']==MOD) ? ADMIN : $userdata['user_level']));
$sql = "SELECT DISTINCT banner_id, banner_name, banner_spot, banner_description, banner_forum FROM ".BANNERS_TABLE ."
WHERE banner_active
AND IF(banner_level_type,IF(banner_level_type=1,'".$sql_level."'<=banner_level,IF(banner_level_type=2,'".$sql_level."'>=banner_level,'".$sql_level."'<>banner_level)),banner_level='".$sql_level."')
AND (banner_timetype='0'
OR (( $hour_now BETWEEN time_begin AND time_end) AND ((banner_timetype='2'
OR (( $week_now BETWEEN date_begin AND date_end) AND banner_timetype='4')
OR (( $date_now BETWEEN date_begin AND date_end) AND banner_timetype='6')
)))) ORDER BY banner_spot,SUBSTRING(RAND(),6,2)*banner_weigth";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't get banners data", "", __LINE__, __FILE__, $sql);
}
$banners = array();
$i=0;
while ($banners[$i] = $db->sql_fetchrow($result))
{
$banner_spot=$banners[$i]['banner_spot'];
if ($banner_spot<>$last_spot AND ($banners[$i]['banner_forum']==$forum_id || !$banners[$i]['banner_forum']))
{
$template->assign_var('BANNER_'.$banner_spot.'_IMG', '<a href="'.append_sid('redirect.'.$phpEx.'?banner_id='.$banners[$i]['banner_id']).'" target="_blank"><img src="'.$banners[$i]['banner_name'].'" border="0" alt="'.$banners[$i]['banner_description'].'" title="'.$banners[$i]['banner_description'].'"></a>');
$banner_show_list.= ', '.$banners[$i]['banner_id'];
}
$last_spot = ($banners[$i]['banner_forum']==$forum_id || !$banners[$i]['banner_forum']) ? $banner_spot : $last_spot;
$i++;
}
#
#-----[ OPEN ]------------------------------------------
#
MX directory/includes/page_tail.php
#
#-----[ FIND ]------------------------------------------
#
die('Hacking attempt');
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
if ($banner_show_list)
{
$banner_show_list['0'] = ($banner_show_list) ? ' ':'';
$sql = "UPDATE ".BANNERS_TABLE." SET banner_view=banner_view+1 where banner_id IN ($banner_show_list)";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't update banners data", "", __LINE__, __FILE__, $sql);
}
}
#
#-----[ OPEN ]------------------------------------------
#
MX directory/templates/subSilver/overall_header.tpl
#
#-----[ FIND ]------------------------------------------
#
<a name="top"></a>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<!-- Banners -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" colspan="3"><div align="center">{BANNER_0_IMG}</div></td>
</tr>
<tr>
<td width="20%">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr><td><div align="center">{BANNER_1_IMG}</div></td></tr>
<tr><td><div align="center">{BANNER_2_IMG}</div></td></tr>
</table>
</td>
<td width="60%">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr><td><div align="center">{BANNER_3_IMG}</div></td></tr>
<tr><td><div align="center">{BANNER_4_IMG}</div></td></tr>
</table>
</td>
<td width="20%">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr><td><div align="center">{BANNER_5_IMG}</div></td></tr>
<tr><td><div align="center">{BANNER_6_IMG}</div></td></tr>
</table>
</td>
</tr>
</table>
<!-- End Banners -->
#
#-----[ OPEN ]------------------------------------------
#
MX directory/templates/subSilver/overall_footer.tpl
#
#-----[ FIND ]------------------------------------------
#
</tr>
</table>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<!-- Banners -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr><td><div align="center">{BANNER_7_IMG}</div></td></tr>
<tr><td><div align="center">{BANNER_8_IMG}</div></td></tr>
</table>
</td>
<td width="60%">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr><td><div align="center">{BANNER_9_IMG}</div></td></tr>
<tr><td><div align="center">{BANNER_10_IMG}</div></td></tr>
</table>
</td>
<td width="20%">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr><td><div align="center">{BANNER_11_IMG}</div></td></tr>
<tr><td><div align="center">{BANNER_12_IMG}</div></td></tr>
</table>
</td>
</tr>
</table>
<!-- End Banners -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
NOTE: If like me you are using a different theme to subSilver, you might have to skip each template step and just add the required variables in your templates. So you add {BANNER_0_IMG} to you MX overall_header.tpl and {BANNER_1_IMG} to your overall_footer.tpl for example. You could even put {BANNER_0_IMG} to you MX overall_header.tpl and {BANNER_1_IMG} to your phpBB overall_header.tpl, thus showing different banners for each.
(you could then alter language/lang_english/lang_banner.php to reflect their position, but it’s not necessary if you know what variable is where)
Now upload all the edited files into the required directories within MX.
Step 3:
- Code: Select all
#
#-----[ OPEN ]------------------------------------------
#
phpBB directory/redirect.php
#
#-----[ FIND ]------------------------------------------
#
define('IN_PHPBB', true);
#
#-----[ REPLACE WITH ]------------------------------------------
#
define('IN_PORTAL', true);
#
Save in MX folder on your computer and upload to mx directory of your web.
Though you have just opened the redirect.php from your phpBB folder, make sure you do not save to that folder, instead save to your MX directory and upload to your web MX directory. This is important both these files need to be right and in the right place for redirect to work properly.
Note: Though the CBM admin shows when you are in the admin section of the MX portal, you will not be able to use. You will have to be within the phpBB admin section to do so.

