Community Add-Ons
| Maintainers: | jpweber |
Activate Flash Immediately
for osCommerce Online Merchant v2.2
If you incorporate Flash, or any other type of <object> or <embed> controls into your OSC, you're probably annoyed by the "click here to activate and use this control" annoyance that Microsoft came up with in 2005. You have to hover over it, click it once, and then your Flash will begin to work. Many people don't know how to fix this, and it's annoying, especially if you have, say, a Flash menu. So here's what you do:
(1) Upload fixit.js to your server.
(2) Simply place this following line after the last <object> in your page:
<script type="text/javascript" src="fixit.js"></script>
Simple as that! Flash files, embedded objects, Active X controls, etc., will all work immediately in your OSC without the annoyance of the "click to activate" thing ever again!
Jason
Put this code in js script tag or in js file and link with your page :
<script type="text/javascript">
function write(source) {
document.write(source);
}
</script>
In your PHP page put this code, where $IpBanner is the html code for this object.
This is working with all obejct, not only with flash objects.
<?php
$IpBanner = '<object type="application/x-shockwave-flash" data="images/banners/gol.swf" width="468"height="60"><param name="movie" value="images/banners/gol.swf" /><param name="wmode" value="transparent"></object>';
?>
<script type="text/javascript">
var source = '<?php echo $IpBanner; ?>';
write(source);
</script>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Of course this is a example. If you undertstand you don't will have more problems.
For example, I update this function to show flash banners :
function tep_display_banner($action, $identifier) {
if ($action == 'dynamic') {
$banners_query = tep_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'");
$banners = tep_db_fetch_array($banners_query);
if ($banners['count'] > 0) {
$banner = tep_random_select("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'");
} else {
return '<b>(tep_display_banner(' . $action . ', ' . $identifier . ') -> Nenhum banner cadastrado para o grupo '' . $identifier . '' !</b>';
}
} elseif ($action == 'static') {
if (is_array($identifier)) {
$banner = $identifier;
} else {
$banner_query = tep_db_query("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . (int)$identifier . "'");
if (tep_db_num_rows($banner_query)) {
$banner = tep_db_fetch_array($banner_query);
} else {
return '<b>(tep_display_banner(' . $action . ', ' . $identifier . ') -> Banner com id '' . $identifier . '' não encontrado, ou status inativo</b>';
}
}
} else {
return '<b>(tep_display_banner(' . $action . ', ' . $identifier . ') -> Parâmetro $action desconhecido - deve ser 'dynamic' ou 'static'</b>';
}
if (tep_not_null($banner['banners_html_text'])) {
$banner_string = $banner['banners_html_text'];
} else {
if ( substr($banner['banners_image'], -3, 3) == 'swf' ) {
$size = getimagesize(DIR_WS_IMAGES . "banners/". $banner['banners_image']);
$banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . mm_output_flash_movie( $banner['banners_title'], DIR_WS_IMAGES . "banners/". $banner['banners_image'] , $size[0] , $size[1]) . '</a>';
} else {
$banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . "banners/". $banner['banners_image'], $banner['banners_title']) . '</a>';
}
}
tep_update_banner_display_count($banner['banners_id']);
return $banner_string;
}
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Good luck!
Best Regards
Sylvio Ruiz
Rio de Janeiro - Brazil
