balkan7 Posted January 5, 2008 Share Posted January 5, 2008 soryy my previous topic are solved and i start new topic whit good example to create 2 function for show banners, here is detail inforamtion for that... banner_plans - i got 5 : 1. header, 2. sub-header, 3.right, 4.right2 and 5. footer. banner_type - 0 is image, 1 is flash. banner_state - 0 is inactive, 1 is active plans 1,2,5 have same width and height, i wanna create one function for this. plan 3 have difrent width and height, maybe need new function for this and plan 4 have difrent W and H. same like plan 3. code for Prepare Banners for display, functions are: <?php function ss($text){ return stripslashes($text); } function setBannerView($banData){ global $db_prefix; $currentData = explode(".", $banData['banner_clicks']); $newViews = $currentData[1] + 1; $lastData = implode(".", array($currentData[0], $newViews)); $updateViews = dbquery("UPDATE ".$db_prefix."btr_banners SET banner_clicks = '$lastData' WHERE banner_id = ".$banData['banner_id'].""); } //Show Banner function function showBanner($banData, $type="int"){ global $db_prefix; setBannerView($banData); if ($banData['banner_type'] == "0" AND $banData['banner_plans'] == "1"){ $type = (strpos($banData['banner_img'], "http://") !== false) ? "ext" : "int"; return "<a href='".INFUSIONS."marketing_panel/banner_click.php?banner_id=".ss($banData['banner_id'])."' target='_blank' title='".ss($banData['banner_name'])."'> <img alt='".ss($banData['banner_name'])."' src='".($type=="int" ? ss($banData['banner_img']) : ss($banData['banner_img']))."' border='0' width='468' height='60' /> </a>"; } else { if ($banData['banner_type'] == "1" AND $banData['banner_plans'] == "1"){ return "<embed width='468' height='60' src='".ss($banData['banner_url'])."' />"; } } } //Prepare Banners for display function displayBanners(){ global $db_prefix, $locale; $bannersDb = dbquery("SELECT * FROM ".$db_prefix."btr_banners WHERE banner_state = '1'"); if (dbrows($bannersDb)){ while ($tbData = dbarray($bannersDb)) $possRand[] = $tbData['banner_id']; $prCount = count($possRand)-1; $rand = mt_rand(0, $prCount); $banData = dbarray(dbquery("SELECT * FROM ".$db_prefix."btr_banners WHERE banner_state = '1' AND banner_id = ".$possRand[$rand])); return showBanner($banData); } else { return $locale['BB_001']; } } Link to comment https://forums.phpfreaks.com/topic/84633-function-show-banner/ Share on other sites More sharing options...
Ken2k7 Posted January 5, 2008 Share Posted January 5, 2008 What's your question/problem here? Link to comment https://forums.phpfreaks.com/topic/84633-function-show-banner/#findComment-431244 Share on other sites More sharing options...
balkan7 Posted January 5, 2008 Author Share Posted January 5, 2008 i need difrent call plans because this not working propertly: <?php if ($banData['banner_type'] == "0" AND $banData['banner_plans'] == "1") ?> Link to comment https://forums.phpfreaks.com/topic/84633-function-show-banner/#findComment-431251 Share on other sites More sharing options...
balkan7 Posted January 5, 2008 Author Share Posted January 5, 2008 i have tried whit function but whiout result <?php //Show Banner function function showBanner($banData, $type="int"){ global $db_prefix; setBannerView($banData); if ($banData['banner_plans'] == "1"){ if ($banData['banner_type'] == "0"){ $type = (strpos($banData['banner_img'], "http://") !== false) ? "ext" : "int"; return "<a href='".INFUSIONS."marketing_panel/banner_click.php?banner_id=".ss($banData['banner_id'])."' target='_blank' title='".ss($banData['banner_name'])."'> <img alt='".ss($banData['banner_name'])."' src='".($type=="int" ? ss($banData['banner_img']) : ss($banData['banner_img']))."' border='0' width='468' height='60' /> </a>"; } else { if ($banData['banner_type'] == "1"){ return "<embed width='468' height='60' src='".ss($banData['banner_url'])."' />"; } } } }?> Link to comment https://forums.phpfreaks.com/topic/84633-function-show-banner/#findComment-431440 Share on other sites More sharing options...
balkan7 Posted January 7, 2008 Author Share Posted January 7, 2008 can someone help me whit which command i call $banData['banner_plans'] in functions posted up ? banner_plans are 5 i need call banners whit $banData['banner_plans']. Link to comment https://forums.phpfreaks.com/topic/84633-function-show-banner/#findComment-432790 Share on other sites More sharing options...
Ken2k7 Posted January 7, 2008 Share Posted January 7, 2008 What's your question/problem here? Quoting myself. Again, please tell us what you need help with. Posting a code and not telling us what you want doesn't help. Link to comment https://forums.phpfreaks.com/topic/84633-function-show-banner/#findComment-432791 Share on other sites More sharing options...
sasa Posted January 7, 2008 Share Posted January 7, 2008 i need difrent call plans because this not working propertly: <?php if ($banData['banner_type'] == "0" AND $banData['banner_plans'] == "1") ?> 'banner_type' can't be == 0 AND == 1 in same time if statement is allways false Link to comment https://forums.phpfreaks.com/topic/84633-function-show-banner/#findComment-432806 Share on other sites More sharing options...
Ken2k7 Posted January 7, 2008 Share Posted January 7, 2008 But it doesn't say banner_type to be equal to 0 and 1 at the same time. You said banner_type and banner_plans. Link to comment https://forums.phpfreaks.com/topic/84633-function-show-banner/#findComment-432807 Share on other sites More sharing options...
balkan7 Posted January 7, 2008 Author Share Posted January 7, 2008 yes i my mistake start whit 0 but show banners whit 0 and 1 0 = jpg, gif 1 = swf i have tried whit that but whitout result, ever show banner ever not show <?php if ($banData['banner_type'] == "0" AND $banData['banner_plans'] == "1") ?> soryy for bad english... Link to comment https://forums.phpfreaks.com/topic/84633-function-show-banner/#findComment-432857 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.