[TUTORIAL] Complete Banner mod on MX portal

a complete banner management system, any number of banners can be added
Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

[TUTORIAL] Complete Banner mod on MX portal

Postby justin on Fri 19. Dec, 2003 16:02

Mod by Niels Chr. Denmark

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.
Last edited by justin on Sun 21. Dec, 2003 09:46, edited 1 time in total.
justin
Poster
Poster
 
Posts: 11
Joined: Sat 18. Oct, 2003 20:37

Thank you very much!

Postby Navid on Sat 20. Dec, 2003 13:20

Thank you very much! Thank you very much! Thank you very much! Thank you very much! Thank you very much! Thank you very much! Thank you very much! Thank you very much! Thank you very much!

But i have one problem, i installed this on my Spacepiliot3k theme and it worked fine, but when i use subsilver the forum images are gone not on the portal but in the forum every image file is strangely gone.
Navid
Poster
Poster
 
Posts: 6
Joined: Wed 17. Dec, 2003 18:43

Postby justin on Fri 26. Dec, 2003 16:58

I am a little unsure of your problem, post a link so we can see your problem for ourselves.
justin
Poster
Poster
 
Posts: 11
Joined: Sat 18. Oct, 2003 20:37

Postby Navid on Sun 04. Jan, 2004 23:03

do you have msn?
Navid
Poster
Poster
 
Posts: 6
Joined: Wed 17. Dec, 2003 18:43

Postby Navid on Sun 04. Jan, 2004 23:36

think you can upload overal_header and footer for subsilver?
Navid
Poster
Poster
 
Posts: 6
Joined: Wed 17. Dec, 2003 18:43

Postby Navid on Fri 12. Mar, 2004 23:18

i keep getting Hacking attempt when i press the banner...
Navid
Poster
Poster
 
Posts: 6
Joined: Wed 17. Dec, 2003 18:43

Postby skullJo on Mon 10. Jan, 2005 20:22

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.



In my portal this TUTORIAL doesnt work!

In step 1:I never upload banner but I use HTML code! :?

What can I do?
skullJo
Poster
Poster
 
Posts: 3
Joined: Mon 10. Jan, 2005 19:46

I'm going to fix it with new mx version

Postby Priit Tamboom on Tue 10. May, 2005 03:02

This tutorial is not working for new version of mx-portal 2.7.6.

I'm going to fix this tutorial for new version of mxBB 2.7.6 (mx portal), if someone would like to join, please call skype priit.tamboom or just reply here.

however, first I have to make the complete banner work under the new version of mx portal.

Priit
Priit Tamboom
Poster
Poster
 
Posts: 4
Joined: Fri 05. Nov, 2004 12:10

Next

Return to Complete banner [2.0.6/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron