EDIT:// deleted LoadjQuery Droplet to prevent issues of this methode with WB official functions and/or other modules!
use the official Methode to load jquery files!
Code:
// 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');
} ?>
regards martin
Very good work, Martin.
Till now I am using all my plugins from inside my template.
But your handling is very handy and I think I will get inspired by this function to make life easier.
Thank you for this contribution!
I know how much work such a project can be. 8-)
Regards,
Stefek
including jquery is possible in head or body. if you use droplets you have to included it in head, otherwise you can include it in body
Dietmar
Quote from: Luisehahne on January 08, 2010, 02:39:55 PM
including jquery is possible in head or body. if you use droplets you have to included it in head, otherwise you can include it in body
Dietmar
hi dietmar - nice to know that you are watching this since you are really a pro with jQuery stuff!
this fact is correct for the core - the core has to implementet by "handediting" the template! it's the same way the register_frontend_modfiles work!
for jQuery Plugins like the scroll to Top Plugin
the Droplet put/replace all the needed files in the frontend ->
without coded in the template before head or body (just the droplet itself!)
i put my droplets only in the backend under the page_footer (or header it's equal) and it works correct and replace the things where they should be!
you can run short/fast PHP strpos(); for classes like "fancybox" or rel-tags like "lightbox" to load needed fieles!
(witch do the work of a frontendworking insert.js....that need more resources like some php string searches?)
i'm just finishing some droplet that make use of such Plugins - be patient to see how easy it is to implement it on a working page or test some effects!
regards martin
Quote from: mr-fan on January 08, 2010, 02:59:09 PM
the Droplet put/replace all the needed files in the frontend ->without coded in the template before head or body (just the droplet itself!)
...........
be patient to see how easy it is to implement it on a working page or test some effects!
I can acknowledge this.
Tested this function and some droplets created by Martin and it is a very easy way to impelent jQuery Plugins.
Works great on demand (if you demand a plugin it will be loaded, else it won't).
Test it first.
Then judge 8-)
Regards,
Stefek
But be carefull to load jquery core not twice
Dietmar
a german statement in german board
https://forum.WebsiteBaker.org/index.php/topic,16618.0.html
Quote from: Luisehahne on January 08, 2010, 03:07:35 PM
But be carefull to load jquery core not twice
Dietmar
if you looked at the code you will see that i implemented rudimentary checks to prevent from double loading files....but this could maybe made in a better way...(with an array - but strpos don't work with arrays i gues...?)
for such issues i posted this piece of code - not to say hey this is the best way to implement jQuery! i wanna fix that statment!!
this is the result of my minds to get a smoother way to handle this
for my opinion the best way would be a backend admin tool for installing jQuery Plugins - and they are loaded in the backend if they needed and work all the time.... 8-)
since there is no such solution that fits my needs - i've created this droplet that do this work for me...
->i can change things in the backend without edit many templates or something once
->i've a solution that i could setup how i need it (see improviced pagelist function to activate/deactivate for spezific pages)
(->even if i don't use modules/snippets with jQuery i could use it in a way that works with this page_footes technique i mentioned abouve to load the droplet in all templates without changing everthing!)
in the german post from maverik sprouted a mixure of topics .....loadjQuery <->jQuery Plugin Droplets!
this are two different things - the jQuery Plugin Droplets could be used even if you've just put one line in your template:
<script type="text/JavaScript" src="<?php echo WB_URL; ?>/include/jquery/jquery-min.js"></script>
only post suggestions, improments to the topics LoadjQuery Droplet here please!
for the "jQuery Droplets" i wrote - i will make a new threat for every Droplet like this is the best way to separating such things!
[/b]
thanks
martin
so here are some real usefull examples how to use a Droplet to get jquery start to work...
Lightbox Droplet (https://forum.websitebaker.org/index.php/topic,16833.msg110464.html#msg110464)for WB 2.8.1 (the included plugins)
Scroll to Top Droplet (https://forum.websitebaker.org/index.php/topic,16834.0.html) that creates all full automatically
runs in all Templates that are installed you could switch it off/on in the backend....
regards martin