[*droplet*] colorBoxOnLoad (Pop up your Ad)

Tomno399

Sorry, now I realize that I have written in German Language in an English thread.

Stefek, many thanks to you. The droplet works with the colorbox-plugin http://jquery.lepton-cms.org/plugins/lightbox-effects/jq-colorbox.php and the jQuery 1.32).

A newer plugin, which would work with jQuery >1.9 I couldn't find. Yeah, we have to practice patience.

Thank you Stefek!

Stefek

Hallo,

schau mal so:

DROPLETS CODE:
Code (ColorboxOnLoad) Select

<?php 
global $database$wb;

//check if sID is set
if(empty($sID) || !is_numeric($sID)){
$output '<p>you must specify a sectionID to run the "ColorboxOnLoad" droplet</p>';
}else{
$output "";

$cookie "sID_".$sID;

//  EXPIRATION
// @parameter:  'expire'
// @required: no
$expire = (!isset($expire)) ? (120) : $expire;
if (!isset($_COOKIE[$cookie])) {
setcookie($cookie'1'time()+$expire); //setcookie($cookie, '1', time()+60*60*24*7);
} else {
return $output//we stop the script here
}
  
//  GET SECTION
// @parameter: 'sID'
// @required: yes!
if($module_check $database->get_one(sprintf("SELECT `module` FROM `%s` WHERE `section_id` = '%d'"
TABLE_PREFIX."sections" ,$sID ))) {   

$section_id intval($sID); // [!]variable needed for the included file 
        
ob_start();        
        require(
WB_PATH.'/modules/'.$module_check.'/view.php');
        
// here is our content within two divs, one is hidden via style definition
        
$output .= '<div style="display:none;"><div id="colorbox_section">'.ob_get_contents().'</div></div>';
        
ob_end_clean();            
    } else {
    
// if requested Section doesn't exist
    
$output .= "<p>The requested section wasn't found</p>";
}  
    
// width & height
$width  (!isset($width) || !is_numeric($width)) ? ( 550 ) : intval($width);
$height  (!isset($height)|| !is_numeric($height)) ? ( 420 ) : intval($height);

$output .= <<<_SCRIPT
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready( function () {
$('.cboxOnLoad').colorbox({
inline: true, 
href: '#colorbox_section',
innerWidth:
$width
innerHeight:
$height,
maxWidth: "98%",
maxHeight: "98%",
});
$('a.cboxOnLoad').click();
 
});
/* ]]> */
</script>
_SCRIPT;

//  BOX TITLE
// @parameter:  'title'
// @required: no
if(isset($title) && is_string($title)){
$title sprintf(' title="%s"'$title);
$title str_replace('&quot;',''$title);
}else {
$title '';
}
$output .= '<a class="colorbox"></a>'// needed to initialize Maverik's cBox snippet 
$output .= '<a class="cboxOnLoad" '.$title.' href="#"></a>';
}
return 
$output;
?>



Das Droplet ist alt, da habe ich grad meine ersten Gehversuche mit PHP gemacht ;-)

Schönen Gruß,
Stefek
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Tomno399

WB283 SP4; PHP 5.5

Das Droplet zeigt schon beim Speichern einen Fehler (roter Tropfen). Eine Syntaxprüfung des Codes ergab "Parse error: syntax error, unexpected 'else' (T_ELSE) in /in/eeLmI on line 7". Komisch, dass der Fehler schon ab PHP 4 und jetzt bis PHP 5.6. angezeigt wird.
Hat jemand dafür eine Lösung?

PurpleEdge


iradj

On my page also works with IE8 (evgberg.de)

Iradj

maverik

#9
please have a look at www.see-canada.de

does this work in ie8 ?

i cant find the mistake, on my site its the same as see-canada.de. on my site it dont work in ie8 on see-canada it works.  :?

maverik


dbs

yes, you're right, in FF, Opera & Chrome it works well.
f... IE is a problem.
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

PurpleEdge

I'm using IE 8.0.6 and the popup doesn't appear in the example link you posted, only the blanked-out screen...

http://www.websitebaker.net/pages/labor/cbsection.php

...works OK in FF.

dbs

thx for share, no problems with jQA, works well ;-)
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

maverik

Robbi Williams......äh..Take That......äh..use this 

my english ist not well because i find die wörter net so schnell..  :-D

[gelöscht durch Administrator]

dbs

hi, have you a zip of the droplet, for import?
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

iradj

Christian,

Thank you for that droplet. It is very nice and better than ShowAd. Thanks also to Maverik.

Iradj

Stefek

#1
Hello,

this is another droplet I'd like to share with you.
Special thanks to user Maverik for help, tips and suggestions.

The droplet is still in development, so you may suggest improvements, wishes...

What is it for?

You can use this droplet to pop up an add, banner, information box on page load.
You will be able to set a expiration time, so the droplet will be loaded only once for a specified time.
You will (need to) specify a Section ID which will be loaded into the ColorBox.
You may use a WYSIWYG or any other kind of Section (not any module makes sense though).
You may also specify the height and width of the box to display.

See it in action
Maverik placed the droplet for testing purposes here:
http://www.websitebaker.net/pages/labor/cbsection.php
(Thanks)

What is needed?
You will need the ColorBox snippet:
DOWNLOAD
Just install it.
You will also need the current "official" jQuery inclusion in you template.
(Maverik's ColorBox snippet makes use of the $insert method included in WB Core).
Ask if you have questions to be answered.

I am sure, the droplet will also work using jQuery Admin if you prefere -
but it would need small adjustments to be done (I guess).


Droplets Parameters

[[ColorboxOnLoad?sID=77&width=640&height=490&expire=600&title="here comes a title"]]

Let's break it down:
?sID=77  -> this is the sectionID you want to fetch the content from (required)

&width=640 (optional, default=550)
&height=490 (optional, default=420)
&expire=600 (optional, default=120) // seconds   
&title="here comes a title" (optional, default (empty))

If you want the Box to pupup at any page load, set
&expire=1.


DROPLETS CODE:
Code (ColorboxOnLoad) Select

<?php 
global $database$wb;

//check if sID is set
if(empty($sID) || !is_numeric($sID))
$output '<p>you must specify a sectionID to run the "ColorboxOnLoad" droplet</p>';
else{
$output "";

$cookie "sID_".$sID;

//  EXPIRATION
// @parameter:  'expire'
// @required: no
$expire = (!isset($expire)) ? (120) : $expire;
if (!isset($_COOKIE[$cookie]))  
setcookie($cookie'1'time()+$expire); //setcookie($cookie, '1', time()+60*60*24*7);
else
return $output//we stop the script here
 
  
//  GET SECTION
// @parameter: 'sID'
// @required: yes!
if($module_check $database->get_one(sprintf("SELECT `module` FROM `%s` WHERE `section_id` = '%d'"
TABLE_PREFIX."sections" ,$sID ))) {   

$section_id intval($sID); // [!]variable needed for the included file 
        
ob_start();        
        require(
WB_PATH.'/modules/'.$module_check.'/view.php');
        
// here is our content within two divs, one is hidden via style definition
        
$output .= '<div style="display:none;"><div id="colorbox_section">'.ob_get_contents().'</div></div>';
        
ob_end_clean();            
    } else 
    
// if requested Section doesn't exist
    
$output .= "<p>The requested section wasn't found</p>";
    
    
// width & height
$width  (!isset($width) || !is_numeric($width)) ? ( 550 ) : intval($width);
$height  (!isset($height)|| !is_numeric($height)) ? ( 420 ) : intval($height);

$output .= <<<_SCRIPT
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready( function () {
$('.cboxOnLoad').colorbox({
inline: true, 
href: '#colorbox_section',
innerWidth:
$width
innerHeight:
$height,
maxWidth: "98%",
maxHeight: "98%",
});
$('a.cboxOnLoad').click();
 
});
/* ]]> */
</script>
_SCRIPT;

//  BOX TITLE
// @parameter:  'title'
// @required: no
if(isset($title) && is_string($title)){
$title sprintf(' title="%s"'$title);
$title str_replace('&quot;',''$title);
}else  $title '';

$output .= '<a class="colorbox"></a>'// needed to initialize Maverik's cBox snippet 
$output .= '<a class="cboxOnLoad" '.$title.' href="#"></a>';
}
return 
$output;


?>




Kind Regards,
Stefek


[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden