1. Hack short banners v1.0

Hack short banners v1.0

  |   3
Hack short banners v1.0

Author: MSW
Original Hack (Russian): http://0-web.ru/dle/hack-dle/245-shortbanners-v1.html
Version DLE: 8. * -9. *

Hack ShortBanners v1.0
nice hack to allows for more flexible management of promotional materials on your site, which allows you to specify how many counts of news to display a banner when viewing a summary of news.

Features:
- automatic generation of the list, display banners amoung short news, depending on the amount of news to display on the main page

- a reduced number of logical operations, compared with standard management
function Dle banners among brief news


instructions:

1. open: /engine/inc/banners.php

Search for:

echo makeDropDown( array ("0" => $lang['banners_s_0'], "1" => $lang['banners_s_1'], "2" => $lang['banners_s_2'], "3" => $lang['banners_s_3'], "4" => $lang['banners_s_4'], "5" => $lang['banners_s_5'], "6" => $lang['banners_s_6'], "7" => $lang['banners_s_7'] ), "short_place", $short_place );


Replace with:

#****** ShortBanners *** by MSW ******#    $banners_s = array("0" => $lang['banners_s_0']);    for($i=1; $i<=$config['news_number']; $i++) {        $banners_s[$i] = "After {$i}";    }    echo makeDropDown( $banners_s, "short_place", $short_place );#****** ShortBanners *** by MSW ******#



2. open:/engine/modules/banners.php

looking for:

switch ($value['short_place']) //Choose location of banner                {                    case 1 : //Top                        $ban_short['top'][] = array ("text" => $value['code'], "zakr" => $value['bstick'] );                        break;                                        case 2 : //Center                        $ban_short['cen'][] = array ("text" => $value['code'], "zakr" => $value['bstick'] );                        break;                                        case 3 : //Bottom                        $ban_short['down'][] = array ("text" => $value['code'], "zakr" => $value['bstick'] );                        break;                                        case 4 : //Top and Bottom                        $ban_short['top'][] = array ("text" => $value['code'], "zakr" => $value['bstick'] );                        $ban_short['down'][] = array ("text" => $value['code'], "zakr" => $value['bstick'] );                        break;                                        case 5 : //Center and Bottom                        $ban_short['cen'][] = array ("text" => $value['code'], "zakr" => $value['bstick'] );                        $ban_short['down'][] = array ("text" => $value['code'], "zakr" => $value['bstick'] );                        break;                                        case 6 : //Center and Top                        $ban_short['cen'][] = array ("text" => $value['code'], "zakr" => $value['bstick'] );                        $ban_short['top'][] = array ("text" => $value['code'], "zakr" => $value['bstick'] );                        break;                                        case 7 : //Center,Top and Bottom                        $ban_short['cen'][] = array ("text" => $value['code'], "zakr" => $value['bstick'] );                        $ban_short['top'][] = array ("text" => $value['code'], "zakr" => $value['bstick'] );                        $ban_short['down'][] = array ("text" => $value['code'], "zakr" => $value['bstick'] );                        break;                }


Replace with:

#****** ShortBanners *** by MSW ******#                if($value['short_place']>0) $ban_short[$value['short_place']][] = $value['code'];#****** ShortBanners *** by MSW ******#



3. open: /engine/modules/show.short.php

find and remove:

if( isset( $ban_short ) ) {            for($indx = 0, $max = sizeof( $ban_short['top'] ), $banners_topz = ''; $indx < $max; $indx ++)                if( $ban_short['top'][$indx]['zakr'] ) {                    $banners_topz .= $ban_short['top'][$indx]['text'];                    unset( $ban_short['top'][$indx] );                }                        for($indx = 0, $max = sizeof( $ban_short['cen'] ), $banners_cenz = ''; $indx < $max; $indx ++)                if( $ban_short['cen'][$indx]['zakr'] ) {                    $banners_cenz .= $ban_short['cen'][$indx]['text'];                    unset( $ban_short['cen'][$indx] );                }                        for($indx = 0, $max = sizeof( $ban_short['down'] ), $banners_downz = ''; $indx < $max; $indx ++)                if( $ban_short['down'][$indx]['zakr'] ) {                    $banners_downz .= $ban_short['down'][$indx]['text'];                    unset( $ban_short['down'][$indx] );                }                        $middle = floor( $config['news_number'] / 2 );            $middle_s = floor( ($middle - 1) / 2 );            $middle_e = floor( $middle + (($config['news_number'] - $middle) / 2) + 1 );        }


search in same file:

if( isset( $middle ) ) {                        if( $news_c == $middle_s ) {                $tpl->copy_template .= bannermass( $banners_topz, $ban_short['top'] );            } else if( $news_c == $middle ) {                $tpl->copy_template .= bannermass( $banners_cenz, $ban_short['cen'] );            } else if( $news_c == $middle_e ) {                $tpl->copy_template .= bannermass( $banners_downz, $ban_short['down'] );            }            $news_c ++;        }


Replace with:

#****** ShortBanners *** by MSW ******#        if($ban_short[$news_c]) {            $banner_rand = array_rand($ban_short[$news_c]);            $tpl->copy_template .= $ban_short[$news_c][$banner_rand];        }        $news_c ++;#****** ShortBanners *** by MSW ******#


That`s all, enjoy it bokali
Tested on dle 9.5 bravo
Dear visitor, you are browsing our website as Guest.
We strongly recommend you to register and login to view hidden contents.

Details

+5

Comments 3

jopaulmj
jopaulmj
V.I.P.
Commented By jopaulmj on April 7, 2012 (10:19 am)
This Is Awesome bravo
5 26Forum topics : 0Forum replies : 0Forum likes : 0
Gozan
Gozan
V.I.P.
Commented By Gozan on April 8, 2012 (9:37 am)
jopaulmj,
thanks thumbsup
33 132Forum topics : 20Forum replies : 88Forum likes : 7
Gozan
Gozan
V.I.P.
Commented By Gozan on April 10, 2012 (9:28 pm)
jopaulmj,
i send u email,ur PM is full angry
33 132Forum topics : 20Forum replies : 88Forum likes : 7
Information!Would you like to leave your comment? Please Login to your account to leave comments. Don't have an account? You can create a free account now.