I am not sure where to post this; but, this is my solution for applying the same properties of the banner_box_all to all banner groups.
I took the code from sideboxes/tpl_banner_box_all.php and added it as a function in includes/functions/banner.php.
Here is the function in its entirety:
Definition for the function parameters:PHP Code:////
// Displays all banners from specified group
function zen_display_all_banners($action, $identifier, $display=true) {
global $db, $request_type;
switch ($request_type) {
case ('SSL'):
$my_banner_filter=" and banners_on_ssl= " . "1 ";
break;
case ('NONSSL'):
$my_banner_filter='';
break;
}
$new_banner_search = zen_build_banners_group($identifier);
$sql = "select banners_id, banners_title, banners_image, banners_html_text, banners_open_new_windows, banners_url from " . TABLE_BANNERS . " where status = 1 " . $new_banner_search . $my_banner_filter;
if ($action == "dynamic") {
$sql .= " order by rand()";
} else {
$sql .= " order by banners_sort_order";
}
$banners_all = $db->Execute($sql);
$banner_cnt = 0;
$content = "";
while (!$banners_all->EOF) {
$code = zen_display_banner('static', $banners_all->fields['banners_id']);
$data[$banner_cnt] = $banners_all->fields;
$data[$banner_cnt]["banners_image_link"] = DIR_WS_IMAGES . $banners_all->fields['banners_image'];
$data[$banner_cnt]["banners_html_link"] = zen_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banners_all->fields['banners_id']);
$data[$banner_cnt]["banners_code"] = $code;
$content .= $code;
if ($banner_cnt < $banners_all->RecordCount()) {
$content .= '<br /><br />';
}
$banner_cnt++;
$banners_all->MoveNext();
}
if ($banner_cnt == 0) {
return false;
}
if ($display) {
return $content;
}
return $data;
}
$action: "dynamic" = random; "static" = by sort order
$identifier: the banner group id
$display: true = returns the same content as sideboxes/tpl_banner_box_all.php; false = returns an array of banners
Fields in the array of banners:
banners_id: banner id
banners_title: banner title
banners_image: banner image file name
banners_html_text: the alt text for banner ?
banners_open_new_windows: whether the banner should open in a new window
banners_url: the url the banner should click to
banners_code: the code you get from zen_display_banner()
banners_image_link: the image path found in banners_code
banners_html_link: the link path found in banners_code
For example, to access the banner title for the 2nd banner in the "Banner Display Groups - Header Position 2" group, you would do:
To get the same results as tpl_banner_box_all.php, you would do:PHP Code:$banners = zen_display_all_banners("static",SHOW_BANNERS_GROUP_SET2, false);
$title = $banners[1]["banners_title"];
Hope this helps someone.PHP Code:$banners = zen_display_all_banners("dynamic",SHOW_BANNERS_GROUP_SET2);
echo $banners;



