Hacks
How to hack in the banner component to display flash banners
Main Menu
| Home |
| Joomla Install |
| Administration |
| Joomla Components |
| Joomla Modules |
| Joomla Bots |
| Joomla SEO |
| Hacks |
|
|
|
| How to hack in the banner component to display flash banners |
|
|
|
|
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> I found this little hack by Fotis Evangelou. Seems to be all over the net... Thanks for sharing!!!
The default banners component that ships with Joomla, does not natively support flash, I guess for various reasons, but one being that "hey, what the community is for?"... So I decided to hack the standard com_banners component to get flash banners working as normal images would. Follow the instructions carefully, it's not difficult. Each step responds to a different file that needs to be changed (three files in all) and all you have to do is just copy - paste!
1. administrator/components/com_banners/admin.banners.html.php
at about line 275, change this:
if (eregi("swf", $_row->imageurl)) {
?>
<img src="images/blank.png" name="imagelib">
<?php
to this: Code:
if (eregi("swf", $_row->imageurl)) {
$imageurl = "../images/banners/".$_row->imageurl;
$getflashinfo = @getimagesize( $imageurl );
echo '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
width="'.$getflashinfo[0].'" height="'.$getflashinfo[1].'">
<param name="movie" value="'.$imageurl.'" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<embed src="'.$imageurl.'" quality="high" wmode="transparent"
pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"
width="'.$getflashinfo[0].'" height="'.$getflashinfo[1].'"></embed>
</object>';
2. modules/mod_banners.php at about line 85 change this: Code:
} else if (eregi("\.swf$", $banner->imageurl)) {
$imageurl = "$mosConfig_live_site/images/banners/".$banner->imageurl;
echo "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"
codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\"
border=\"5\">
<param name=\"movie\" value=\"$imageurl\"><embed src=\"$imageurl\" loop=\"false\"
pluginspage=\"http://www.macromedia.com/go/get/flashplayer\"
type=\"application/x-shockwave-flash\">
</embed></object>";
to this (if you want the link specified in the admin to be on top of your flash banner):
Code:
} else if (eregi("\.swf$", $banner->imageurl)) {
$imageurl = "$mosConfig_live_site/images/banners/".$banner->imageurl;
$link = sefRelToAbs( 'index.php?option=com_banners&task=click&bid='. $banner->bid );
$getflashinfo = @getimagesize( $imageurl );
echo '
<a href="'.$link.'" target="_blank" style="display:block;position:absolute;
width:'.$getflashinfo[0].'px;height:'.$getflashinfo[1].'px;z-index:999;"></a>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
width="'.$getflashinfo[0].'" height="'.$getflashinfo[1].'" style="position:relative;z-index:0;">
<param name="movie" value="'.$imageurl.'" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<embed src="'.$imageurl.'" quality="high" wmode="transparent"
pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"
width="'.$getflashinfo[0].'" height="'.$getflashinfo[1].'" style="position:relative;z-index:1;">
</embed>
</object>';
or to this (if you don't want any link on top of your flash banner, which seems logical since almost all commercial flash banners already link to somewhere): Code:
} else if (eregi("\.swf$", $banner->imageurl)) {
$imageurl = "$mosConfig_live_site/images/banners/".$banner->imageurl;
$getflashinfo = @getimagesize( $imageurl );
echo '
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"
width="'.$getflashinfo[0].'" height="'.$getflashinfo[1].'" style="position:relative;z-index:0;">
<param name="movie" value="'.$imageurl.'" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<embed src="'.$imageurl.'" quality="high" wmode="transparent"
pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"
width="'.$getflashinfo[0].'" height="'.$getflashinfo[1].'"></embed>
</object>';
3. includes/joomla.php inside function images, commented in the file as: Code: /** * build the select list to choose an image */ function Images and below that, at about line 4826, change this: Code:
if ( eregi( "bmp|gif|jpg|png", $file ) ) {
to this Code:
if ( eregi( "bmp|gif|jpg|png|swf", $file ) ) {
Here we added swf support for the file browser inside the banners component admin. Conclusion By simply copy-pasting three blocks of code we managed to give the standard joomla distro support for flash banners. It wasn't difficult now, was it? Thanks again, Fotis! plugin by VivoCiti.com
|
| < Prev | Next > |
|---|
|
|
|




I found this little hack by 








