/** * Format and display banner * * @param $result mysql result set result set to retrieve banner details * @param $bType string banner type * */ public function displayBanners($result, $bType) { $imgArr = array(); if ($bType == 'featured') { $counter = 0; while ($row = mysql_fetch_array($result)) { $lstId = $row[0]; $lstTitle = $row[1]; $lstTagline = $row[2]; $exts = array('bmp', 'png', 'jpg', 'gif', 'jpeg'); foreach ($exts as $ext) { $bPath = "ads/" . $bType . "/" . $row[3] . "." . $ext; if (file_exists($bPath)) { $imgArr[$counter][0] = $lstId; $imgArr[$counter][1] = makeURLSafe($lstTitle); $imgArr[$counter][2] = $lstTagline; $imgArr[$counter][3] = $bPath; $counter++; } } } return $imgArr; } while ($row = mysql_fetch_array($result)) { $lstId = $row[0]; $lstTitle = $row[1]; $exts = array('bmp', 'png', 'jpg', 'gif', 'jpeg'); foreach ($exts as $ext) { $bPath = "ads/" . $bType . "/" . $row[3] . "." . $ext; if (file_exists($bPath)) { if ($bType == 'top') { return formatTopBanner($bPath, $lstId, $lstTitle); } else { if ($bType == 'vertical') { return formatVerticalBanner($bPath, $lstId, $lstTitle); } else { if ($bType == 'bottom') { return formatBottomBanner($bPath, $lstId, $lstTitle); } } } } } } }
exit; } $title = ""; $mainCategory = ""; $subCategory = ""; $phone = ""; $street = ""; $city = ""; $country = ""; $zipcode = ""; $package = ""; $sql = "SELECT b.title AS title, b.package AS pkg, m.name AS mainCat, s.name AS subCat, c.phone AS phone, l.street AS street, l.city AS city, l.country AS country, l.zip_code AS zip FROM lbs_biz b, lbs_biz_contacts c, lbs_biz_location l, lbs_biz_main_categories m, lbs_biz_sub_categories s WHERE b.biz_id = '{$lid}' AND b.biz_id = c.biz_id AND b.biz_id = l.biz_id AND b.main_category = m.main_category_id AND b.sub_category = s.sub_category_id"; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { $title = $row['title']; $safeTitle = makeURLSafe($title); $package = $row['pkg']; $mainCategory = $row['mainCat']; $subCategory = $row['subCat']; $phone = $row['phone']; $street = $row['street']; $city = $row['city']; $country = $row['country']; $zipcode = $row['zip']; } if ($package == 'b') { } else { if ($package == 's') { } else { if ($package == 'g') { }
function formatVerticalBanner($path, $bizId, $title) { $safeTitle = makeURLSafe($title); //$listing_url = "http://localhost/business_directory/listing/$safeTitle-$bizId.html"; $listing_url = SITE_URL . "/listing/{$safeTitle}-{$bizId}.html"; return "<a href='{$listing_url}'><img src='{$path}' width='240px' height='400px'/></a>"; }