SmartFAQ is developed by The SmartFactory (https://www.smartfactory.ca), a division of InBox Solutions (https://www.inboxsolutions.net)

How to display banner adds in other blocks as well as in header.?
Create a cutom block with the following code:
include_once XOOPS_ROOT_PATH.'/include/functions.php';
global 
$xoopsConfig;
$db =& Database::getInstance();
$bannerobject '';
$bresult $db->query("SELECT COUNT(*) FROM ".$db->prefix("banner"));
list (
$numrows) = $db->fetchRow($bresult);
if ( 
$numrows ) {
    
$numrows $numrows-1;
    
mt_srand((double)microtime()*1000000);
    
$bannum mt_rand(0$numrows);
} else {
    
$bannum 0;
}
if ( 
$numrows ) {
    
$bresult $db->query("SELECT * FROM ".$db->prefix("banner"), 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$datetime());
        
$db->queryF($sql);
        
$db->queryF(sprintf("DELETE FROM %s WHERE bid = %u"$db->prefix("banner"), $bid));
    }
    if (
$htmlbanner){
        
$bannerobject $htmlcode;
    }else{
    
$bannerobject '
.XOOPS_URL.'/banners.php?op=click&bid='.$bid.'" target="_blank">';
        if (
stristr($imageurl'.swf')) {
            
$bannerobject $bannerobject
                
.''
                
.'.$imageurl.'">'
                
.''
                
.'.$imageurl.'" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"; type="application/x-shockwave-flash" width="468" height="60">'
                
.''
                
.'';
        } else {
            
$bannerobject $bannerobject.'.$imageurl.'" alt="" />';
        }

        
$bannerobject $bannerobject.'
'
;
}
echo 
$bannerobject;
}
Save this with a title and as php script. Position in your Page as required. NOTE: Make sure your adds are suitably sized for the blocks you are using, or else your adds will distort and break out.


The comments are owned by the author. We aren't responsible for their content.
user

 Does this mean that I can create different size banners?


Does the above described block mean that I can have different size banners?

If yes, how can I assign banners to the different boxes?

Or is it only possible to have one size of banner box shared with all the banner ads?

 
user

 Re: Does this mean that I can create different size banners?


I tried this hack as well as two other similar but none of them works. It displays an empty block with just a block title. Is there anything else needed to be done beside just create new block, copy/paste the code and tell it it is php...?

 
user

 Re: Does this mean that I can create different size banners?


I used this in a custom block on 2.2.3 Xoops. Displays correctly for me. I have not rotated banners yet but will test later.

Did you set to PHP and not auto? Auto did give me errors.

don (el paso)

 
user

 Re: Does this mean that I can create different size banners?


hi there,

I've tried this and it works fine - but can i ask is there any way of specifying to use a vertical banner? (or whatever!).

As the only reason you'd use this is to have different types of banners around your page, it's pretty essential that you can state whether to use the vertical advert or a horizontal one etc etc...

Any ideas?

 
user

 Banners in Blocks


Isn't it also possible to create a custom PHP block with only the following inside:

showbanner();

 
user

 Re: Banners in Blocks


I use this:
put the following code in a custom block as a php script.

echo xoops_getbanner();

 
user

 Re: Banners in Blocks


any ideas how to select a specific banner in a block?

i tried

echo xoops_getbanner(bid);

but it doesnt seems to work

 
user

 Re: Banners in Blocks


it's just supposed to be

echo xoops_getbanner();

don't put anything in between the parentheses. It works on my site.

 
user

 Re: Banners in Blocks


Has anyone figured out how to get specific banners to show up in a certain place. or to get only vertical banners to show up in one spot and horizontal banners to show up in another spot?

Using

echo xoops_getbanner();

is there a way to tell it which banner to display?

 
user

 Revolution of Xoops Banners System


Important news about XOOPS Banners:

CLICK HERE

 
user

 Save as a PHP Script


Remember to save it as a PHP Script not an HTML.
It worked for me perfectly.

 


Login

Who's Online

332 user(s) are online (5 user(s) are browsing XOOPS FAQ)


Members: 0


Guests: 332


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Did you know ?

you can use a simple php script to change file/folder permissions!

Random question

How do I install a hack?