1
First, I created by own banner. It was 500x200 originally but after Googling I changed it to 468x20. There was a posting that said this was the limit of the size banners xoops would accept. Can someone confirm that for me please?
Next I tried to get the banner to display but no results. I don't even know where it's suppose to display at. But the funny things it that the banner admin section is applying expressions even without seeing the banner.
Next I tried blocks. I found a posting for "
Revolution Banner System" and so I pasted the appropriate code within the function.php within the root_directory/include/
function getbanner_from_id_banner($banner_id) { ###### Hack by www.stefanosilvestrini.com ###### global $xoopsConfig; $db =& Database::getInstance(); $bresult = $db->query("SELECT COUNT(*) FROM ".$db->prefix("banner")." WHERE bid = ". $banner_id); list ($numrows) = $db->fetchRow($bresult); if ( $numrows > 1 ) { $numrows = $numrows-1; mt_srand((double)microtime()*1000000); $bannum = mt_rand(0, $numrows); } else { $bannum = 0; } if ( $numrows > 0 ) { $bresult = $db->query("SELECT * FROM ".$db->prefix("banner")." WHERE bid = ". $banner_id, 1, $bannum); list ($bid, $cid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $date, $htmlbanner, $htmlcode) = $db->fetchRow($bresult); if ($xoopsConfig['my_ip'] == xoops_getenv('REMOTE_ADDR')) { // EMPTY } else { $db->queryF(sprintf("UPDATE %s SET impmade = impmade+1 WHERE bid = %u", $db->prefix("banner"), $bid)); } /* Check if this impression is the last one and print the banner */ if ( $imptotal == $impmade ) { $newid = $db->genId($db->prefix("bannerfinish")."_bid_seq"); $sql = sprintf("INSERT INTO %s (bid, cid, impressions, clicks, datestart, dateend) VALUES (%u, %u, %u, %u, %u, %u)", $db->prefix("bannerfinish"), $newid, $cid, $impmade, $clicks, $date, time()); $db->queryF($sql); $db->queryF(sprintf("DELETE FROM %s WHERE bid = %u", $db->prefix("banner"), $bid)); } if ($htmlbanner){ $bannerobject = $htmlcode; }else{ $bannerobject = ''; } return $bannerobject; } } function getbanner_from_id_client($client_id) { ###### Hack by www.stefanosilvestrini.com ###### global $xoopsConfig; $db =& Database::getInstance(); $bresult = $db->query("SELECT COUNT(*) FROM ".$db->prefix("banner")." WHERE cid = ". $client_id); list ($numrows) = $db->fetchRow($bresult); if ( $numrows > 1 ) { $numrows = $numrows-1; mt_srand((double)microtime()*1000000); $bannum = mt_rand(0, $numrows); } else { $bannum = 0; } if ( $numrows > 0 ) { $bresult = $db->query("SELECT * FROM ".$db->prefix("banner")." WHERE cid = ". $client_id ." ORDER BY rand()", 1, $bannum); list ($bid, $cid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $date, $htmlbanner, $htmlcode) = $db->fetchRow($bresult); if ($xoopsConfig['my_ip'] == xoops_getenv('REMOTE_ADDR')) { // EMPTY } else { $db->queryF(sprintf("UPDATE %s SET impmade = impmade+1 WHERE bid = %u", $db->prefix("banner"), $bid)); } /* Check if this impression is the last one and print the banner */ if ( $imptotal == $impmade ) { $newid = $db->genId($db->prefix("bannerfinish")."_bid_seq"); $sql = sprintf("INSERT INTO %s (bid, cid, impressions, clicks, datestart, dateend) VALUES (%u, %u, %u, %u, %u, %u)", $db->prefix("bannerfinish"), $newid, $cid, $impmade, $clicks, $date, time()); $db->queryF($sql); $db->queryF(sprintf("DELETE FROM %s WHERE bid = %u", $db->prefix("banner"), $bid)); } if ($htmlbanner){ $bannerobject = $htmlcode; }else{ $bannerobject = ''; } return $bannerobject; } }
Now from this I am suppose to be able to post any of the below php code in the block to get the banner to show:
any random banner
echo xoops_getbanner();
based on banner ID
echo getbanner_from_id_banner(ID_BANNER);
a random client banner, based on client ID
echo getbanner_from_id_client(ID_CLIENT);
And I found 2 more:
echo
echo ""; echo ""; echo xoops_getbanner(); echo " |
"; echo "
";
IF/ESLE
global $xoopsConfig; if ($xoopsConfig['banners'] == 1) { //Display Banner echo (xoops_getbanner()); } else { return false; }
The posting Im reading are a little outdated from the current Xoops version. All other posts show and mention being able to select PHP for the block. My version doesn't give me that option.
1. I need help getting the banners to display or a reason why that aren't displaying or a thought as to where they are suppose to display by default.
2. I also need help finding out why php doesn't display in my blocks.
Any help is appreciated.