Sorry, this page is only available in one language

ShowAd2

Suggested dropletname: ShowAd

Published by: Aldus

Improved ShowAd with more options optional arguments for the stepsize, timeout, starting-, and endposition

global $database, $wb;
$get_content = $database->query("SELECT content FROM ".TABLE_PREFIX."mod_wysiwyg WHERE section_id = '$section'");
$fetch_content = $get_content->fetchRow();
$content =$fetch_content['content'];
$wb->preprocess($content);
if (!isset($timeout)) $timeout=50;
if (!isset($step)) $step = 25;
if (!isset($start)) $start = -450;
if (!isset($target)) $target = 100;
$style  = '';
$script  = '<script>';
$script .= 'var timer;var h = '.$start.';var w = 250;var t = '.$target.'; ';
$script .= 'function startAp(){setLeft();showAp();}';
$script .= 'function hideAp() {if (document.layers) document.layers.pa.visibility = "hide";else if (document.all) document.all.pa.style.visibility = "hidden";else if (document.getElementById) document.getElementById("pa").style.visibility = "hidden";}';
$script .= 'function showAp() {state=typeof tPos;if(state=="undefined") tPos = h;if(tPos < t) {tPos+='.$step.';if(document.layers) document.layers.pa.top = tPos+"px";else if (document.all) document.all.pa.style.top = tPos+"px";else if (document.getElementById) document.getElementById("pa").style.top = tPos+"px";}';
$script .= 'if(timer!=null) clearInterval(timer);timer = setTimeout("showAp()",'.$timeout.');}';
$script .= 'function getoPos() {if (document.layers) alert(document.layers.pa.top);else if (document.all) alert(document.all.pa.style.top);else if (document.getElementById) alert(document.getElementById("pa").style.top);}';
$script .= 'function setLeft() {if (document.layers) document.layers.pa.left = ((window.innerWidth / 2) - (w / 2))+"px";else if (document.all) document.all.pa.style.left = ((document.body.offsetWidth / 2) - (w / 2))+"px";else if (document.getElementById) document.getElementById("pa").style.left = ((window.innerWidth / 2) - (w / 2))+"px";}';
$script .= '</script>';
$page  = '<div id="pa"><div class="pa_close"><a href="javascript:void(0)" onclick="hideAp()">[close]</a></div>';
$page .= $content;
$page .= '</div>';
$start = '<script type="text/javascript">startAp();</script>';
return $style.$script.$page.$start;

Optional parameters:

timeout=(milliseconds)
step=(stepsize)
start=(startposition)
target=(targetposition)

Usage:

[[showad?section=53&timeout=25&step=10&start=-250&target=200]]



« Previous droplet | Overview | Next droplet »