[New Plugin] jQuery4CMSimple

Third Party Plugins to CMSimple - how to install, use and create plugins

Moderator: Tata

cmb
Posts: 13273
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: [New Plugin] jQuery4CMSimple

Post by cmb » Thu Sep 01, 2011 10:39 pm

Hello Holger,
Holger wrote:I think there's a general misunderstanding on how "global" works or between what "global" is doing or not doing (= the superglobals in PHP)
Nope! I guess we must not consider the superglobals in this case. And I'm pretty sure we both know, what the global "declaration" means.
Holger wrote: Where is the advantage to include jquery.inc.php inside another include and not in the plugins index.php?
Basically none! But that's not the point: consider the "A" plugin mentioned above. It includes jquery.inc.php in index.php, but it will definitly fail (at least on NTFS). If you can spare some additional time, please have a look at the "A" plugin. Make sure that it gets included before the jquery plugin, and you will see, what I'm talking about.

Or you might consider the following example:
a.php:

Code: Select all

$var = 'a';
function a() {
    include('b.php');
    echo $var;
}
a(); 
b.php:

Code: Select all

$var = 'b';
function b() {
    global $var;
    echo $var;
}
b(); 
Browsing to a.php will display "a\nb"!
Holger wrote:again, IMO it's better to make things not more complicated than they are
+ 1
All I was asking for, is to extend the example in the jQuery4CMSimple documentation to

Code: Select all

global $pth, $plugin_cf; //be sure CMSimple variables are accessible in your function
 
to avoid further problems. ;)

Oh, and BTW: I really love jQuery4CMSimple, because it makes it so easy to use jQuery for CMSimple, and, of course, because jQuery/jQueryUI rocks :D

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

Holger
Site Admin
Posts: 3115
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany
Contact:

Re: [New Plugin] jQuery4CMSimple

Post by Holger » Thu Sep 01, 2011 10:41 pm

Arghh :twisted: !

Now I understand what you mean :idea:
(in Deutsch hätten wir das vielleicht in 1/10 der Zeit erledigt - sorry)
cmb wrote:a plugin called "A".
and
cmb wrote:This is due to the pluginloaders strategy to include all files of a plugin (index, admin, config, etc) instead of first including the configs of all plugins
Yep! The old problem with the order plugins / plugin-configs are loaded from the PL.

In this case, the code in $hjs will miss the contents stored in the plugin-config :? .

But even if it's nonsense (IMHO) to declare function myplugin() in index.php to call it at the end of the script after the closing braked of the function, I agree that in this case jQuery4CMSimple may fail, when the calling script was loaded before jQuery4CMSimple.

So I should add a "global $plugin_cf" to the documentation until the strategy of the PL will change? :roll:

Holger

cmb
Posts: 13273
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: [New Plugin] jQuery4CMSimple

Post by cmb » Thu Sep 01, 2011 11:00 pm

Hello Holger,
Holger wrote:Yep! The old problem with the order plugins / plugin-configs are loaded from the PL.
...
In this case, the code in $hjs will miss the contents stored in the plugin-config
Yep!
Holger wrote:But even if it's nonsense (IMHO) to declare function myplugin() in index.php to call it at the end of the script after the closing braked of the function
+ 1 But the example given in the documentation might invite to do so.
Holger wrote:So I should add a "global $plugin_cf" to the documentation until the strategy of the PL will change?
I really don't know, if the strategy will change sometimes (that might be something to discuss in another forum ;)). But even if it does, the "global $plugin_cf" shouldn't hurt.
Holger wrote:(in Deutsch hätten wir das vielleicht in 1/10 der Zeit erledigt - sorry)
Probably you're right. So I have to excuse myself for not switching to our mother tongue ;)

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 13273
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: [New Plugin] jQuery4CMSimple

Post by cmb » Thu Sep 08, 2011 12:39 am

Hello Holger,

it's me again ;)

This time it's about jQueryUI's datepicker. Really very nice, flexible and easy to use. But unfortunatly in jQuery4CMSimple the i18n is missing. For Advancedform_XH I'm using the datepicker, so I have to include all necessary language files to the plugin. That's not really problem for me. But if other plugins will use the jQueryUI datepicker, their authors have to do this again. So wouldn't it be nice, if the jQuery4CMSimple plugin would bring along the datepicker language files, so these could be used by different plugins?

OTOH I'm not quite sure, if the language files should be supplied by the jQuery4CMSimple plugin, or if those files should be included to the seperate language packs required for the upcoming version of CMSimple_XH. What's your opinion? Shall I suggest to the maintainers of the language packs to include the necessary language files for the datepicker, or do you want to include them to the jQuery4CMSimple plugin?

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply