#1
Posted 31 January 2012 - 02:43 PM
I don't really understand how to use the jquery modules. Until now I just loaded jquery and fancybox directly from my template, but this might not be the best way to go (although it gives the possibility to combine and compress all .js & .ccs files to improve loading times).
What should I do to load jquerycore and fancybox using the modules?
Thanks in advance!
/Jasper
#3
Posted 31 January 2012 - 03:00 PM
#4
Posted 31 January 2012 - 03:01 PM
<?php
// loads modules, that will add it to the script loading below
$this->modules->get("JqueryCore");
$this->modules->get("JqueryFancybox");
?>
<?php foreach($config->styles->unique() as $file) echo "\n\t<link type='text/css' href='$file' rel='stylesheet' />"; ?>
<?php foreach($config->scripts->unique() as $file) echo "\n\t<script type='text/javascript' src='$file'></script>"; ?>
Of course apeisa and diogo is right, but I just wanted to show it's possible.
Edit: while kinda on topic. Ryan, could we have an updated Fancybox? The current in PW "1.2.6" is way outdated. I always struggle to get iframes working. I could need some of the more advanced features, options in the PW admin.
@somartist | modules created | support me, flattr my work flattr.com
#5
Posted 31 January 2012 - 03:13 PM
Slightly off topic, Why don't you load jQuery from a CDN like they recommend on the Fancybox website? Loading times should be better because tat copy of jQuery may be already cached on the user browser.
I actually do.
With a fallback, just in case the CDN is unavailable (I believe Google's CDN is blocked in some countries, although I don't expect many visitors from these countries...)
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
if (typeof jQuery == 'undefined')
{document.write(unescape("%3Cscript src='http%3A%2F%2Fmydomain.info%2Fjs%2Fjquery.min.1.7.1.js' type='text/javascript'%3E%3C/script%3E"));}
</script>
Thanks! That explains a lot.Those modules are intended for admin usage only. Are you trying to use those on your site or in admin module?
/Jasper
#6
Posted 31 January 2012 - 03:21 PM
#7
Posted 31 January 2012 - 03:26 PM
but I use it just for admin related tools, prototyping with bootstraping. It wouldn't be recomended using it in front-end production, because of the things apeisa mentioned.
@somartist | modules created | support me, flattr my work flattr.com
#9
Posted 01 February 2012 - 11:45 AM
Slightly off topic, Why don't you load jQuery from a CDN like they recommend on the Fancybox website? Loading times should be better because tat copy of jQuery may be already cached on the user browser.
This is a good thing to do with your own sites, but not a good thing for ProcessWire to do since we can't safely assuming PW is "online". PW is used in some offline contexts. I develop offline too.
Those modules are intended for admin usage only. Are you trying to use those on your site or in admin module?
What Antti said is correct. I recommend including your own jQuery scripts for your site. While you certainly can use PW's jQuery modules, it's best to keep the needs of your site independent from the needs of the admin (to prevent a PW upgrade from breaking something in your site's javascript, for example). jQuery stuff isn't always backwards compatible.
Edit: while kinda on topic. Ryan, could we have an updated Fancybox? The current in PW "1.2.6" is way outdated. I always struggle to get iframes working. I could need some of the more advanced features, options in the PW admin.
I originally used 1.2.6 rather than the newer one, because the newer one was buggy, and having issues with new versions of jQuery. This may have changed in the last year (hopefully anyway). If anyone has a moment to check it out and test, I'll be happy to upgrade it. Otherwise I'll take care of it as soon as there's time to properly test on this end.
Also tagged with one or more of these keywords: jquery, module
Community Support →
General Support →
MarkupTwitterFeed - where do I get the feed?Started by vayu, 13 Jun 2013 |
|
|
||
Community Support →
Modules/Plugins →
Audio MP3 Flash PlayerStarted by kixe, 13 Jun 2013 |
|
|
||
Community Support →
Modules/Plugins →
Simple Module for Session messagesStarted by Harmster, 09 Jun 2013 |
|
|
||
Module
Community Support →
Modules/Plugins →
ProcessEmailToPageStarted by Pete, 02 Jun 2013 |
|
|
||
Community Support →
Modules/Plugins →
Markup Load AtomStarted by teppo, 02 Jun 2013 |
|
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













