Skip to content

Commit

Permalink
Fixes #3141 - Tweak banner menu display
Browse files Browse the repository at this point in the history
If banner_amount is empty, display unlimited
  • Loading branch information
Moc committed Feb 1, 2019
1 parent 8c05592 commit f4fe262
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions e107_plugins/banner/banner_menu.php
Expand Up @@ -13,8 +13,6 @@
*
* Handles the display and sequencing of banners on web pages, including counting impressions
*
* @package e107_plugins
* @subpackage banner
*/

if (!defined('e107_INIT')) { exit; }
Expand All @@ -33,17 +31,13 @@
require(e_PLUGIN.'banner/banner_template.php');
}




$menu_pref = e107::getConfig('menu')->getPref(''); // legacy preference lookup.

if(defset('BOOTSTRAP'))
{
$BANNER_MENU_START = $BANNER_TEMPLATE['menu']['start'];
$BANNER_MENU_ITEM = $BANNER_TEMPLATE['menu']['item'];
$BANNER_MENU_END = $BANNER_TEMPLATE['menu']['end'];

$BANNER_MENU_END = $BANNER_TEMPLATE['menu']['end'];
}
else
{
Expand Down Expand Up @@ -74,10 +68,10 @@



// print_a($menu_pref);
//print_a($menu_pref);


if(!empty($menu_pref['banner_campaign']) && !empty($menu_pref['banner_amount']))
if(!empty($menu_pref['banner_campaign']) /*&& !empty($menu_pref['banner_amount'])*/)
{
$sc = e107::getScBatch('banner');

Expand Down Expand Up @@ -124,7 +118,11 @@
$ord[] = " RAND($seed) ASC";

$query .= implode(', ',$ord);
$query .= " LIMIT ".intval($menu_pref['banner_amount']);

if(!empty($menu_pref['banner_amount'])) // if empty, show unlimited
{
$query .= " LIMIT ".intval($menu_pref['banner_amount']);
}

if($data = $sql->retrieve('banner', 'banner_id, banner_image, banner_clickurl,banner_campaign, banner_description', $query,true))
{
Expand Down Expand Up @@ -200,5 +198,4 @@
}


}
?>
}

0 comments on commit f4fe262

Please sign in to comment.