dev-master
9999999-devjQuery view helper for integration into application.
The Requires
- php >=5.3.3
- rayamedia/yima-plugin-installer dev-master
by Payam Naderi
jquery zf2 zf2 module raya media yima jquery integration jquery view helper
jQuery view helper for integration into application.
this module is part of Yima Application Framework, (*1)
The jQuery() view helper simplifies setup of your jQuery environment in your application. All jQuery view helpers put their javascript code onto this stack. It acts as a collector for js scripts in your application., (*2)
We working on modular system and each module can plugged into application and played his role, if module need some jQuery script in view then we have to use up jquery library, how to know that library not attached before, or which version from which address attached ?, (*3)
In other hand we may used another js library like mootools in theme layout of site, and we need to use no conflict mode for jQuery scripts. Are we must edit whole modules script for this?, (*4)
Also we have a collector of whole jQuery scripts, you can do more if thinking more., (*5)
Basic usage in view layout:
php
jQuery()
->setNoConflict()
->setNoConflictHandler('$j')
->appendScript('
$(document).ready(function() {
console.log($.fn);
});
(function ($) {
var SlickEditor = {
TextCellEditor: function (args) {
},
LongTextCellEditor: function (args) {
}
};
// $ inside immediately functions not replaced with noConflict handler
$.extend(window, SlickEditor);
})(jQuery);
');
?>
this will output:
```html
, (*6)
<script type="text/javascript">var $j = jQuery.noConflict();</script> <script type="text/javascript"> $j(document).ready(function() { console.log($j.fn); }); (function ($) { var SlickEditor = { TextCellEditor: function (args) { }, LongTextCellEditor: function (args) { } }; // $ inside immediately functions not replaced with noConflict handler $.extend(window, SlickEditor); })(jQuery); </script>
```, (*7)
return array( 'yima-jquery' => array( /** * Each Delivery Resolve to a jQuery version library address * * foreach deliveries key we must have a service in serviceManager * with name 'YimaJquery\Deliveries\[ServiceName]' in example for key 'service-name' * */ 'deliveries' => array( 'cdn', // or with construct options /* 'cdn' => array( 'cdn-base' => '//cdnjs.cloudflare.com/ajax/libs', 'cdn-subfolder' => 'jquery/', 'cdn-file-path' => '/jquery.min.js', ), */ ), // decorator class or registered service // decorators get container of scripts and render as html or whatever else 'decorator' => 'yimaJquery\Decorator\DefaultDecorator' ), );
No more instruction yet! explore codes see comments and the way it works., (*8)
Composer installation:, (*9)
require rayamedia/yima-jquery
in your composer.json
, (*10)
Or clone to modules folder, (*11)
Enable module in application config, (*12)
To report bugs or request features, please visit the Issue Tracker., (*13)
jQuery view helper for integration into application.
jquery zf2 zf2 module raya media yima jquery integration jquery view helper