Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 01:59:15 AM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155476 Posts in 21708 Topics by 7734 Members
Latest Member: rofroodoOvego
* Home Help Search Login Register
Poll
Question: Are you using Droplets?
Yes, I like the idea!
No, Why?
What are Droplets?

Pages: 1 ... 8 9 [10] 11 12 ... 19   Go Down
Print
Author Topic: New Admin-Tool: Droplets  (Read 50441 times)
doc
Guest
« Reply #225 on: September 29, 2009, 03:05:42 PM »

Hi Aldus,

upps you are right, missed the second r char.
However, pathinfo is a neat function to fetch the file extension from a full file name grin

Doc
« Last Edit: September 29, 2009, 03:13:10 PM by doc » Logged
Vincent

Offline Offline

Posts: 360


WWW
« Reply #226 on: October 07, 2009, 09:56:15 PM »

I used this droplet in WB2.7, and it worked just fine. But after upgrading to WB2.8, it doesn't work any longer. The droplet code is

Code:
return '<span class="hotspot" onmouseover="tooltip.show(\\''.$tip.'\\');" onmouseout="tooltip.hide();">'.$text.'</span>';
But a warning is given that it has invalid php code. Could anyone help me out?
Thanks in advance,

Vincent

Droplet to display a mouseover-infofield

for example to give some more info on a mentioned item

Major thanks to Mr Blacktiger


Logged
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2295



WWW
« Reply #227 on: October 07, 2009, 10:04:27 PM »

There was a bug in the 2.7 version that needed double escaping of ' and ".
In the 2.8 version this is fixed, and any double \\ should be changed to single \.

If you change the line to:
Code: (Droplet)
return '<span class="hotspot" onmouseover="tooltip.show(\''.$tip.'\');" onmouseout="tooltip.hide();">'.$text.'</span>';
it might just work.

R
Logged

Professional WebsiteBaker Solutions
Vincent

Offline Offline

Posts: 360


WWW
« Reply #228 on: October 08, 2009, 08:07:15 AM »

Perfect, thanks!
Logged
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #229 on: October 11, 2009, 07:44:43 PM »

Hi,

This is wierd, could someone please take a look at this code.. The droplet is working in wysiwyg editor, but when you use search, and go to page with this droplet, it is not working...

In sourse, I get only this code:
Code:
<div class="pikachoose"><ul id="pikame"></ul></div>
and there should be an array of <li><img src="..." /></li> between <ul></ul>

I am encountering this first time, and I have no idea where error could be....

This is droplet code:
Code:
$wb_page_data = str_replace('</head>','<!--Galerija-->'."\n".'<link href="'.WB_URL.'/include/jquery/plugins/pikachoose.css" rel="stylesheet" type="text/css"/>'."\n".'<script src="'.WB_URL.'/include/jquery/plugins/pikachoose-min.js" type="text/javascript"></script>'."\n".'<script src="'.WB_URL.'/include/jquery/plugins/pikachoose-set.js" type="text/javascript"></script>'."\n".'</head>', $wb_page_data );

$folder=opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$dir.'/.');
$names = array();
while ($file = readdir($folder))  {
    $ext=strtolower(substr($file,-4));
    if ($ext==".jpg"||$ext==".gif"||$ext==".png"){
        $names[count($names)] = $file;
    }
}
closedir($folder);
reset(shuffle($names));
array_unshift($names," ");
if(isset($width)){$width=' width="'.$width.'"';}else{$width="";}
if(isset($height)){$height=' height="'.$height.'"';}else{$height="";}
$count=1;

while(($image=next($names))and(($count<=$num)or(!isset($num)))){

if( $count ==1){$class=' class="active"';}else{$class='';}

$name=substr($image,0,-4);
if($link=="y"){$images=$images.'<a href="'.WB_URL.MEDIA_DIRECTORY.'/'.$dir.'/'.$image.'" target=_blank>';}
if(file_exists(WB_PATH.MEDIA_DIRECTORY.'/'.$dir.'/thumbs/'.$image.'.thumb.jpg')){
$images=$images.'<img src="'.WB_URL.MEDIA_DIRECTORY.'/'.$dir.'/thumbs/'.$image.'.thumb.jpg" alt="'.$name.'" '.$width.$height.'/>';
}else{
$images=$images.' <li><img src="'.WB_URL.MEDIA_DIRECTORY.'/'.$dir.'/'.$image.'" alt="'.$name.'" '.$width.$height.$class.' /></li>';
}
if($link=="y"){$images=$images.'</a>';}
$count++;
}

return '<div class="pikachoose"><ul id="pikame">'.$images.'</ul></div>';

And the other droplet below it is working, in same wysiwyg editor.. wierd..

all best,
ivan
« Last Edit: October 11, 2009, 07:49:25 PM by crnogorac081 » Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
pcwacht
AddOn Development
*
Offline Offline

Posts: 2856



WWW
« Reply #230 on: October 11, 2009, 08:49:12 PM »

Only thing I can think of
it seems there are no images, could it be that on a search page the constant MEDIA_DIRECTORY is not defined, thus not gettin gany images?

Try a echo MEDIA_DIRECTORY in the beginning to test it.


Good luck hunting,
John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #231 on: October 11, 2009, 09:21:48 PM »

I updated return call:

Code:
return  MEDIA_DIRECTORY.'<div class="pikachoose"><ul id="pikame">'.$images.'</ul></div>';

and I can still se that media folder is returning correctly.. so its not it.. but tnx for trying Smiley
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
pcwacht
AddOn Development
*
Offline Offline

Posts: 2856



WWW
« Reply #232 on: October 11, 2009, 09:53:07 PM »

Next try,

with the droplet call you use variables?
Could it be one of the variables is used by the search page?

Dunnoh what else it could be..
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2295



WWW
« Reply #233 on: October 11, 2009, 10:54:31 PM »

I assume it is the result page of the search where it is not working?

WB adds some <span> tags on the search result pages to hightlight the words that are found.

If you call your droplet [[thisone]], and you searched for the word "one", the result will be:
Code:
[[this<span class="highlight">one</span>]]
At that time the droplet is not recognized by the Droplet engine anymore.

Try naming your droplets different, and see what happens.

R
Logged

Professional WebsiteBaker Solutions
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #234 on: October 11, 2009, 11:31:12 PM »

Hi Ruud,

The droplet seems to be working, and this is the return call in droplet:

Code:
return '<div class="pikachoose"><ul id="pikame">'.$images.'</ul></div>';

I dont know if you understood me well: I type "word" for example, then I go to search result page, where are serch results:

Page 1
_________
this is word ----and the word is hightlighted..

Then I click on Page 1, and when I go there, the droplet is not working... and when I view source of that page I see this code: <div class="pikachoose"><ul id="pikame"></ul></div>

So it seems that when I go from search result page to this page, .$images. is not working... I added $images = ''; at the begining of the droplet code , but still I get nothing.. Sad
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2295



WWW
« Reply #235 on: October 12, 2009, 09:15:58 AM »

You see the code that is generated by the Droplet, except the variable is not filled.
In this droplet this could only be if there are no images (but I assume they are) or the $num variable is wrong.

Droplets can only use variable names that are not yet "defined" or used somewhere. It could very well be that the variable $num is used by the search result parser.
Try setting $num "fixed" in your droplet code, or use a different variable name for it. (i.e. $number_to_show)
The same goes for all other parameters ($link/$dir). Try replacing them with less obvious names.

R

Logged

Professional WebsiteBaker Solutions
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #236 on: October 12, 2009, 03:01:11 PM »

I cut a code a little from uneccessary things, it is working in regular view but still nothing after search...

Code:
$wb_page_data = str_replace('</head>','<!--Galerija radova-->'."\n".'<link href="'.WB_URL.'/include/jquery/plugins/pikachoose.css" rel="stylesheet" type="text/css"/>'."\n".'<script src="'.WB_URL.'/include/jquery/plugins/pikachoose-min.js" type="text/javascript"></script>'."\n".'<script src="'.WB_URL.'/include/jquery/plugins/pikachoose-set.js" type="text/javascript"></script>'."\n".'</head>', $wb_page_data );

$folder_gr=opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$dir_gr.'/.');
$names_gr = array();
while ($file_gr = readdir($folder_gr))  {
    $ext_gr=strtolower(substr($file_gr,-4));
    if ($ext_gr==".jpg"||$ext_gr==".gif"||$ext_gr==".png"){
        $names_gr[count($names_gr)] = $file_gr;
    }
}
closedir($folder_gr);
reset(shuffle($names_gr));
array_unshift($names_gr," ");

$count_gr=1;

while(($image_gr=next($names_gr))and(($count_gr<=$num_gr)or(!isset($num_gr)))){

if( $count_gr ==1){$class_gr=' class="active"';}else{$class_gr='';}

$name_gr=substr($image_gr,0,-4);


$images_gr=$images_gr.' <li><img src="'.WB_URL.MEDIA_DIRECTORY.'/'.$dir_gr.'/'.$image_gr.'" alt="'.$name_gr.'" '.$width_gr.$height_gr.$class_gr.' /></li>';


$count_gr++;
}

return '<div class="pikachoose"><ul id="pikame">'.$images_gr.'</ul></div>';

I added _gr sufix to each variable.. and to droplet code in wysiwyg...

very wierd..

Sad
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #237 on: October 12, 2009, 03:25:10 PM »

Ok, I located problem, the droplet call was [[Gallery?dir=firstName_lastName]] and as I was looking for last name in search, it gave span tag to droplet code - and I think that is why the variable was empty.. I also find that if I search for "a" letter, it gives span tag all over the droplet, which is not recognized by droplet engine, just like you said.. Smiley

Now, I think that best solution in my case is to remove <span> tags from search function... Do you know where to locate this ?

thanks


I assume it is the result page of the search where it is not working?

WB adds some <span> tags on the search result pages to hightlight the words that are found.

If you call your droplet [[thisone]], and you searched for the word "one", the result will be:
Code:
[[this<span class="highlight">one</span>]]
At that time the droplet is not recognized by the Droplet engine anymore.

Try naming your droplets different, and see what happens.

R
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
pcwacht
AddOn Development
*
Offline Offline

Posts: 2856



WWW
« Reply #238 on: October 12, 2009, 03:38:52 PM »

Think you allso need to create a ticket, search should leave droplets alone, though it should have been fixed in wb2.8

I think framework/frontend.functions.php is what you need


John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2295



WWW
« Reply #239 on: October 12, 2009, 03:42:16 PM »

@John,
Search routines were fixed. Droplet tags will not be found by themselves.
I am afraid the result highlighting is not adapted for this.

@crnogorac081
A workaround...

in /search/search.php on line 662 and below the result-link gets the parameter added.
Code:
                       
// Add search string for highlighting
if ($match!='exact') {
    $sstring = implode(" ", $search_normal_array);
    $link = $link."?searchresult=1&amp;sstring=".urlencode($sstring);
} else {
    $sstring = str_replace(" ", "_",$search_normal_array[0]);
    $link = $link."?searchresult=2&amp;sstring=".urlencode($sstring);
}
If you disable/remove this complete block the page will be loaded normally, not as a search-result.

R
Logged

Professional WebsiteBaker Solutions
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #240 on: October 12, 2009, 05:17:04 PM »

It is not working unfortunatelly Smiley At this point, I think it would be the best just to remove <span> tags, and I think it would solve problem...

I found this code in frontend.functions. php :

Code:
       foreach($matches as $match) {
            if($match{0}!="<" && !preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}$/i', $match)) {
                $match = str_replace(array('&lt;', '&gt;', '&amp;', '&quot;', '&#039;', '&nbsp;'), array('<', '>', '&', '"', '\'', "\xC2\xA0"), $match);
                $match = preg_replace('~('.$string.')~ui', '_span class=_highlight__$1_/span_',$match);
                $match = str_replace(array('&', '<', '>', '"', '\'', "\xC2\xA0"), array('&amp;', '&lt;', '&gt;', '&quot;', '&#039;', '&nbsp;'), $match);
                $match = str_replace(array('_span class=_highlight__', '_/span_'), array('<span class="highlight">', '</span>'), $match);
            }
            $foo .= $match;

But I dont know (and I would like) to replace "<span class="highlight">a</span>" with just text "a"..(without span tags)


And also for further development I also think that search function should leave droplet alone Smiley To avoid text between [[ and ]] tags..

This will happen to anyone who use droplets..

It is simple to code ?

cheers 
« Last Edit: October 12, 2009, 06:29:20 PM by crnogorac081 » Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
pcwacht
AddOn Development
*
Offline Offline

Posts: 2856



WWW
« Reply #241 on: October 12, 2009, 08:46:37 PM »

I wrote:
Quote
Think you allso need to create a ticket, search should leave droplets alone, though it should have been fixed in wb2.8

Ruud wrote:
Quote
@John,
Search routines were fixed. Droplet tags will not be found by themselves.
I am afraid the result highlighting is not adapted for this.

Then do not create a ticket for search, create it for result highlighting (wich is part of search) instead....    undecided
Seems to me the same solution can be used as used for the search routine.

The droplets need to stay intact, otherwise they won't work and debugging such a mishappen takes a long time

John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2295



WWW
« Reply #242 on: October 12, 2009, 09:13:42 PM »

Ok, I am not the big regular expressions guru, but this works for me..

In frontend.functions. php from line 107:
Code:
   $matches = preg_split("~(\[\[.*\]\]|<style.*</style>|<script.*</script>|<pre.*</pre>|<code.*</code>|<!--.*-->|<(?:[^<]|<.*>)*>|\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}\b)~iUs",$foo,-1,(PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY));
    if(is_array($matches) && $matches != array()) {
        $foo = "";
        foreach($matches as $match) {
            if($match{0}!="<" && !preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}$/i', $match) && !preg_match('~\[\[.*\]\]~', $match)) {
Only the first line and the last line of this block is changed from the original wb2.8 version.

Please test it, and let us know if it solves your problem too (I think it will)

Ruud
Logged

Professional WebsiteBaker Solutions
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #243 on: October 12, 2009, 10:00:51 PM »

Great,

It works for me too... I think it should be repacked to WB2.8 homepage, as it affect us all Smiley

Now I am kind a happy for discovering this little bug Smiley

Tnx again Ruud, you are guru enough for me  wink
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
snark
Guest
« Reply #244 on: October 14, 2009, 06:40:38 AM »

I saw that with the showsection snippet it is possible to show only a part of the message (link).

Is it also possible to do this with the concertcalender module, so that for instance only the 3 upcoming gigs will be displayed?

Logged
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #245 on: October 15, 2009, 12:14:07 AM »

so now I become expert for droplets..  shocked

Not tested, but try this code:

Code:
global $database, $wb;
$query = mysql_query("SELECT * FROM ".TABLE_PREFIX."mod_concert_settings WHERE section_id = '$section_id'");
if( mysql_num_rows($query) > 0) {
    $fetch_content = mysql_fetch_assoc($query);
    $header_data = stripslashes($fetch_content['header_data']);
    $footer_data = stripslashes($fetch_content['footer_data']);
    $ccloop = stripslashes($fetch_content['ccloop']);
    $detailed_view = $fetch_content['detailed_view'];
    $upcoming_view = $fetch_content['upcoming_view'];
    $previous_view = $fetch_content['previous_view'];
    $previous_num = stripslashes($fetch_content['previous_num']);
    $upcoming_num = stripslashes($fetch_content['upcoming_num']);
    $dateview = $fetch_content['dateview'];
    $date_link = $fetch_content['date_link'];
    $toggle = $fetch_content['toggle'];
}
$today = date('Y-m-d');
$query_dates_upcoming = mysql_query("SELECT * FROM ".TABLE_PREFIX."mod_concert_dates WHERE section_id = '$section_id' && concert_date > '$today' ORDER BY concert_date LIMIT 3");
        $num_rows_upcoming = mysql_num_rows($query_dates_upcoming);
        if ($num_rows_upcoming > 0) {
            while($result_upcoming = mysql_fetch_assoc($query_dates_upcoming)) {
$concerts = $concerts.output($result_upcoming, $dateview, $MOD_CONCERT,$date_link, $ccloop, $toggle);
            }
return '<div class="concertborder"><div class="concert">'.$concerts.'</div>';

good luck Smiley I hope it will work Smiley

Update:
Of course, you must insert section id, forgot to mention that Smiley Here is example, if you name it "concertdroplet":
[[concertdroplet?section_id=123]]
« Last Edit: October 15, 2009, 12:17:43 AM by crnogorac081 » Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
snark
Guest
« Reply #246 on: October 15, 2009, 10:29:57 AM »

it gives a red drop ... in other words: thank you very very much but it does not seem to be okay

Logged
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #247 on: October 15, 2009, 03:15:56 PM »

I will test it later when I get home..

cheers
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
pcwacht
AddOn Development
*
Offline Offline

Posts: 2856



WWW
« Reply #248 on: October 15, 2009, 03:45:27 PM »

You are missing a } I think the one belongs to if statement

Try another } right before the return '<div class="concertborder"><div class="concert">'.$concerts.'</div>';

Might be:
Code:
global $database, $wb;
$query = mysql_query("SELECT * FROM ".TABLE_PREFIX."mod_concert_settings WHERE section_id = '$section_id'");
if( mysql_num_rows($query) > 0) {
    $fetch_content = mysql_fetch_assoc($query);
    $header_data = stripslashes($fetch_content['header_data']);
    $footer_data = stripslashes($fetch_content['footer_data']);
    $ccloop = stripslashes($fetch_content['ccloop']);
    $detailed_view = $fetch_content['detailed_view'];
    $upcoming_view = $fetch_content['upcoming_view'];
    $previous_view = $fetch_content['previous_view'];
    $previous_num = stripslashes($fetch_content['previous_num']);
    $upcoming_num = stripslashes($fetch_content['upcoming_num']);
    $dateview = $fetch_content['dateview'];
    $date_link = $fetch_content['date_link'];
    $toggle = $fetch_content['toggle'];
}
$today = date('Y-m-d');
$query_dates_upcoming = mysql_query("SELECT * FROM ".TABLE_PREFIX."mod_concert_dates WHERE section_id = '$section_id' && concert_date > '$today' ORDER BY concert_date LIMIT 3");
        $num_rows_upcoming = mysql_num_rows($query_dates_upcoming);
        if ($num_rows_upcoming > 0) {
            while($result_upcoming = mysql_fetch_assoc($query_dates_upcoming)) {
$concerts = $concerts.output($result_upcoming, $dateview, $MOD_CONCERT,$date_link, $ccloop, $toggle);
            }
        }

return '<div class="concertborder"><div class="concert">'.$concerts.'</div>';

Have fun,
John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #249 on: October 15, 2009, 10:28:23 PM »

Ok, I am not the big regular expressions guru, but this works for me..

In frontend.functions. php from line 107:
Code:
   $matches = preg_split("~(\[\[.*\]\]|<style.*</style>|<script.*</script>|<pre.*</pre>|<code.*</code>|<!--.*-->|<(?:[^<]|<.*>)*>|\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}\b)~iUs",$foo,-1,(PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY));
    if(is_array($matches) && $matches != array()) {
        $foo = "";
        foreach($matches as $match) {
            if($match{0}!="<" && !preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}$/i', $match) && !preg_match('~\[\[.*\]\]~', $match)) {
Only the first line and the last line of this block is changed from the original wb2.8 version.

Please test it, and let us know if it solves your problem too (I think it will)

Ruud


Do I need to file a ticket , to update packed file on frontpage ?

cheers
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
Pages: 1 ... 8 9 [10] 11 12 ... 19   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!