sfJqueryReloadedPlugin - 1.4.2
You are currently browsing
the website for symfony 1
Easy integration of jQuery
This is a reloaded version of the sfJqueryPlugin wich is compatible with all stable versions of Symfony, including Symfony 1.4.
|Fourat ZOUARI||lead||moc.liamg <<ta>> taruof|
|John Benson||lead||moc.evaknup <<ta>> ynnhoj|
|Tom Boutell||lead||moc.evaknup <<ta>> mot|
|Yannick Gauthier||lead||moc.liamg <<ta>> reihtuag.kcinnay|
Copyright (c) 2004-2008 Fourat ZOUARI
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please contact the sfJqueryReloadedPlugin Google group. That is the best place to report bugs. Some of the maintainers may also be found in the
#symfony channel @ Freenode IRC.
This plugin is licensed under the MIT license. For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
Just make sure you import the helper group
jQuery with a
And give each helper call a
So the classic prototype helper call:
<?php echo link_to_remote(....);?>
<?php echo jq_link_to_remote(....);?>
Install the plugin
$ symfony $ symfony plugin:install sfJqueryReloadedPlugin
Note that you can also check it out as an svn external from:
Optional: change jquery_web_dir in setting.yml if you are not using the traditional symbolic link to the webdir of the plugin (or copying the plugin's /web folder to a folder called sfJqueryPlugin in your web dir, which will also work automatically with our defaults).
all: .settings: jquery_web_dir: /sfJqueryPlugin
Optional: within that folder's /js/ subfolder you might have a different version of jquery other than a minimized 1.3.1 which is what you currently get if you allow the plugin to supply it. This can be a relative path if the file is located in a different folder.
all: .settings: jquery_core: jquery-1.3.1.min.js
Optional: specify different versions of the ui and autocomplete plugins, which would be looked for in the /js/plugins/ subfolder of your jquery_web_dir. Again, you can use relative paths relative to that location in web space if they are in a different place.
all: .settings: jquery_sortable: jquery-ui-1.7.2.custom.min.js jquery_autocomplete: jquery.autocomplete.min.js
If you are running your websites under Microsoft Windows, you also have to manually copy the
directory of the plugin in the
%SF_ROOT_DIR%/web directory of your project
and rename it to
sfJqueryReloadedPlugin. (The ./symfony plugin:publish-assets task should be able to do this for you.)
Inside a template
settings.yml, for all modules
When you use functions that require jQuery plugins, specifically
jq_input_auto_complete_tag, the appropriate
to do this from your
layout.php (including via a component or
partial referenced by
layout.php rather than an action template),
it will not work because
To resolve this issue, call:
<?php jq_add_plugins_by_name(array('sortable', 'autocomplete')) ?>
At the top of your
layout.php file, or just add the js files for the
plugins you need directly to your project's
view.yml file. The first
solution is more maintainable because it means you don't have to pay
close attention when we update to a newer release of a plugin.
To use Jquery methods, refer to Chapter 11 of the classic Symfony 1.0 documentation Ajax Integration. All helper functions described in that chapter can be used with the jq_ prefix.
Note that jQuery and Prototype select elements differently. In cases where selecting just one element is the only thing that makes sense, the helper functions automatically prepend a # so that the selector behaves as it would in Prototype.
jq_periodically_call_remote($options = array())
jq_link_to_function($name, $function, $html_options = array())
jq_link_to_remote($name, $options = array(), $html_options = array())
jq_update_element_function($element_id, $options = array())
jq_form_remote_tag($options = array(), $options_html = array())
jq_submit_to_remote($name, $value, $options = array(), $options_html = array())
jq_visual_effect($effect, $element_id = false, $js_options = array())
jq_add_plugins_by_name($options = array())
These are the methods currently supported by sfJqueryReloadedPlugin. Also see the source for newer and more experimental implementations. Future changes may integrate more functions.
It is possible to use JSON responses with sfJqueryReloadedPlugin. Be sure to read JSON Without Header and consider:
'@delete')), 'dataType' => 'json', 'success' => 'leaveGroup(request)')) ?>
sprintffor string manipulation