WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

You are not logged in.

#1 04.07.2018 11:23:14

alf890
Member

ShowAd Droplet

Guten Tag mal wieder....

Für ein Projekt bin ich über das alte "ShowAd" Droplet gestolpert, das hier seinen Sinn und Zweck eigentlich voll erfüllen sollte...
Ich bin mir auch recht sicher, das "damals", als ich es noch unter WB genutzt habe, man auch ein Bild mit ausgeben konnte und nicht nur Text. Unter WBCE erscheint leider kein Bild mehr, was daran liegt, dass in der Ausgabe eine Variable auftaucht, die ich noch nie gesehen habe:

(...)
<src="{SYSVAR:MEDIA_REL}/pagepix/Open_400.jpg">
(...)

SysVar Media... noch nie vorher gesehen.


Hier der Droplet Code:

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

$style  = '<style>';
$style .= '#pa {max-width:600px;max-height:400px;overflow:auto;font-family:Arial,sans-serif;background:#fff;text-align:center;padding:10px;border:2px solid #002557;position:absolute;z-index:100000;}';
$style .= '#pa .pa_close {padding:0;margin:0;position:absolute;top:5px;right:5px;}';
$style .= '#pa a img {border:none;text-decoration:none;}';
$style .= '</style>';

$script  = '<script>';
$script .= 'var timer;var h = -400;var w = 570;var t = 15;';
$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+=25;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()",5);}';
$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;

Eine Idee, wie man das lösen könnte? Bin ja leider eine SQL/PHP Null :-(

Danke!

Offline

#2 04.07.2018 11:43:33

florian
Administrator

Re: ShowAd Droplet

Ersetz mal das hier

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

durch das hier

global $database, $section_id, $module;
	$content = '';
	$section = isset($section) ? intval($section) : 0;
	if ($section) {
		if (is_readable(WB_PATH.'/modules/wysiwyg/view.php')) {
		// if valid section is given and module wysiwyg is installed
			$iOldSectionId = intval($section_id); // save old SectionID
			$section_id = $section;
			ob_start(); // generate output by regulary wysiwyg module
			require(WB_PATH.'/modules/wysiwyg/view.php');
			$content = ob_get_clean();
            $section_id = $iOldSectionId; // restore old SectionId
		}
	}

(ist aus dem ShowWysiwyg-Droplet)
den Rest so lassen


Code allein macht nicht glücklich. Jetzt spenden!
Und Danke an alle, die diesem Aufruf schon gefolgt sind! thumb_up

Offline

#3 04.07.2018 11:53:06

alf890
Member

Re: ShowAd Droplet

Passt! Danke!
Hatte ich vorher auch schon mal versucht, da ging es nicht... aber nun  smile

Habe gesehen, Dev4Me hat ja noch eine leicht modifizierte Version des Droplets (hänge ich mit den Modifikationen gleich mal unten an, falls sie noch wer brauchen kann). Die macht mir aber noch das Problem, das sie das Overlay nun relativ weit rechts einbindet.. Da vielleicht noch eine Idee? Danke!

global $database, $section_id, $module;
	$content = '';
	$section = isset($section) ? intval($section) : 0;
	if ($section) {
		if (is_readable(WB_PATH.'/modules/wysiwyg/view.php')) {
		// if valid section is given and module wysiwyg is installed
			$iOldSectionId = intval($section_id); // save old SectionID
			$section_id = $section;
			ob_start(); // generate output by regulary wysiwyg module
			require(WB_PATH.'/modules/wysiwyg/view.php');
			$content = ob_get_clean();
            $section_id = $iOldSectionId; // restore old SectionId
		}
	}
if (!isset($timeout)) $timeout=50;
if (!isset($step)) $step = 25;
if (!isset($start)) $start = -450;
if (!isset($target)) $target = 100;

$style  = '<style>';
$style .= '#pa {max-width:600px;max-height:400px;overflow:auto;font-family:Arial,sans-serif;background:#fff;text-align:center;padding:10px;border:2px solid #002557;position:absolute;z-index:100000;}';
$style .= '#pa .pa_close {padding:0;margin:0;position:absolute;top:5px;right:5px;}';
$style .= '#pa a img {border:none;text-decoration:none;}';
$style .= '</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]]

Last edited by alf890 (04.07.2018 11:53:59)

Offline

#4 04.07.2018 12:50:19

florian
Administrator

Re: ShowAd Droplet

Ohne das jetzt im Detail erforscht zu haben: im Originaldroplet steht
$script .= 'var timer;var h = '.$start.';var w = 250;var t = '.$target.'; ';
und in Ruuds
$script .= 'var timer;var h = -400;var w = 570;var t = 15;';


Code allein macht nicht glücklich. Jetzt spenden!
Und Danke an alle, die diesem Aufruf schon gefolgt sind! thumb_up

Offline

#5 04.07.2018 13:38:53

alf890
Member

Re: ShowAd Droplet

Damit lässt sich was anfangen smile
Wie immer tausend Dank!

Offline

#6 05.07.2018 18:01:50

webbird
Administrator

Re: ShowAd Droplet

Wäre vielleicht sinnvoll, das auch einstellbar zu machen.


Ich habe eine Amazon-Wishlist. wink Oder spende an das Projekt.
Ich kann, wenn ich will, aber wer will, dass ich muss, kann mich mal

Offline

Board footer

up