WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Droplets & Snippets => Topic started by: SnapDaddy on August 28, 2012, 12:09:06 AM

Title: How to create a lib_jquery preset to droplets
Post by: SnapDaddy on August 28, 2012, 12:09:06 AM
Hi All,

Is it possible to create a droplet to insert "[[LibInclude?lib=lib_jquery&preset=slimbox]]" or other presets from the insert droplet function in the wysiwyg editor.

Thanks  :-D
Title: Re: How to create a lib_jquery preset to droplets
Post by: dbs on August 28, 2012, 08:14:46 AM
Hi, don't ask, simply try:

dropletname: slimbox
Code: [Select]
return '[[LibInclude?lib=lib_jquery&preset=slimbox]]';
 :wink:
Title: Re: How to create a lib_jquery preset to droplets
Post by: SnapDaddy on August 28, 2012, 10:26:29 PM
Thanks dbs, tried that, but all I get when I insert is the droplet's name of [[Slimbox2]] and not the return of [[LibInclude?lib=lib_jquery&preset=slimbox]]  :?

Here's what I have:

Name: SLimbox2
Description: Inserts the Slimbox2 Preset
Code: return "[[LibInclude?lib=lib_jquery&preset=slimbox]]";
Comments: Use: [[LibInclude?lib=lib_jquery&preset=slimbox]]

I'm using WB 2.8.3 SP1 & Droplet v1.72
Title: Re: How to create a lib_jquery preset to droplets
Post by: dbs on August 28, 2012, 10:55:33 PM
You have something like that in the head of the index.php of your template?
Code: [Select]
<?php
// automatically include optional WB module files (frontend.css, frontend.js)
if (function_exists('register_frontend_modfiles')) {
register_frontend_modfiles('css');
// register_frontend_modfiles('jquery');
register_frontend_modfiles('js');
} ?>
Title: Re: How to create a lib_jquery preset to droplets
Post by: SnapDaddy on August 28, 2012, 11:43:47 PM
Yes. Here's what I have...

Code: [Select]
// this allows to include the optional module files (frontend.css, frontend.js) into the head section
if(function_exists('register_frontend_modfiles')) {
  register_frontend_modfiles('css');
  register_frontend_modfiles('js');
}
Title: Re: How to create a lib_jquery preset to droplets
Post by: dbs on August 29, 2012, 07:17:04 AM
You can use other droplets on other pages?
Have you tried a standard-template like "round"?
Title: Re: How to create a lib_jquery preset to droplets
Post by: BlackBird on August 29, 2012, 10:50:56 AM
??? A droplet that returns droplet markup??? I don't think this can work...
Title: Re: How to create a lib_jquery preset to droplets
Post by: Ruud on August 29, 2012, 11:00:08 AM
A droplet that returns droplet markup??? I don't think this can work...

In WB 2.8.3 it should work. By default "3 levels deep"
Title: Re: How to create a lib_jquery preset to droplets
Post by: dbs on August 29, 2012, 11:11:46 AM
yes it works, have tested.  :wink:
Title: Re: How to create a lib_jquery preset to droplets
Post by: BlackBird on August 29, 2012, 11:12:28 AM
Okay, but does it make sense? :?
Title: Re: How to create a lib_jquery preset to droplets
Post by: dbs on August 29, 2012, 11:13:56 AM
NO  :-D

For this is the page-based-function good, but i can't explain it in english.
The real droplet-call is tooooooo long.
Title: Re: How to create a lib_jquery preset to droplets
Post by: Ruud on August 29, 2012, 11:21:27 AM
In the case of the topic starter I think it makes sense.

This way you can tell a client to include a certain droplet on a page without having to tell him/her about any difficult parameters.
Title: Re: How to create a lib_jquery preset to droplets
Post by: BlackBird on August 29, 2012, 11:52:37 AM
k, ic
Title: Re: How to create a lib_jquery preset to droplets
Post by: SnapDaddy on August 29, 2012, 05:20:32 PM
Good feedback All!

To answer the question why create a droplet to insert a droplet, for me it is for jquery presets I create for client projects and ease of use.

The presets are droplets, but have no way to be inserted, you have to remember the droplet and prams and manually type it in (unless I'm missing something)...yet we have a complete droplet system to insert droplets, with comments as how to use them. So, my post was essentially a way to use the droplet system for jquery (or other) presets.

Since I'm on this topic, if the droplet function was modified to search for existing droplet presets and include them in the droplet dropdown when inserting, it would avoiding having to do what I am doing here!

Anyhow, thanks for the help! I got it working as dbs explained... :-D