1
ljmyers
Display Xoops Banner Using html
  • 2007/2/4 20:28

  • ljmyers

  • Just popping in

  • Posts: 44

  • Since: 2006/1/4 2


To display the XOOPS banners in php I know to use something like . . .

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;
}


But what I would like to try is to display the same banners using html. Possibly using the iframe or embed tags. I'm having the most problem in knowing what to use in place of .$imageurl. but suggestions on the best way to code it would help a lot.

The page I am wanting to add this to has an .htm extension with lots of links pointing at it so changing it to .php and/or using php code is out. I find myself having to use html or possibly even javascript. If anyone could help me out with this it would be great. That is if it can even be done and work correctly.

Thanks - Lana
Smiles,
Lana
MyOnlineMagazine .net
L.J. Myers Company (My first website)

2
TheFinni
Re: Display Xoops Banner Using html
  • 2007/2/6 22:13

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Hi Lana,

The last two days I've been acquainting myself with a technique called mod_rewrite on a Apache server.

You should have a look what you can do with it.

I'm telling you because there's actually a way where you could keep your php document but "transparently" show the .htm file.

So if you have a page called mysite.com/sponsors.htm that the user types into their address bar...they would really be looking at the mysite.com/sponsors.php page.

It's a little tricky to understand first.

Here's an example that you could add in a .htaccess file inside the folder where your "sponsors" page is located at.

Options +FollowSymLinks
RewriteEngine On

RewriteRule 
^sponsors.htmsponsors.php [L]


You will have to play with the RewriteRule to make it work.

Just a thought...

3
ljmyers
Re: Display Xoops Banner Using html
  • 2007/2/7 16:00

  • ljmyers

  • Just popping in

  • Posts: 44

  • Since: 2006/1/4 2


Thanks Finni, I will definately try that out.
Smiles,
Lana
MyOnlineMagazine .net
L.J. Myers Company (My first website)

Login

Who's Online

287 user(s) are online (230 user(s) are browsing Support Forums)


Members: 0


Guests: 287


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!

Latest GitHub Commits