b2evolution b2evolution

  • Sign in
  • Sign up
  • About
  • Downloads
  • Hosting
  • Docs
  • Support
  • Sign in
  • Sign up
  • Manuals Home
  • Latest Updates
 
  1. b2evolution CMS User Manual
  2. Developer Reference
  3. Development
  4. jQuery

jQuery

According to the jQuery website:

"jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. jQuery is designed to change the way that you write JavaScript."

As of b2evolution version 1.10.2, jQuery is included in the /rsc/js directory. All backoffice pages include jQuery and use it for various javascript effects.

Starting in b2evolution version 2.0, there is a function to allow skins and plugins to include jQuery when a blog is displayed.

‘’The rest of this manual page only applies to b2evolution version 2.0 and higher.'’

Using jQuery in a plugin

Do not add the script tag directly using the SkinBeginHtmlHead hook. If other plugins include jQuery, then it could get loaded multiple times, causing a waste of bandwidth and javascript errors. Instead, use this function:
<?php require_js( ‘#jquery#’ ); ?>
This will make sure that jQuery is added to the page, but if another plugin (or the skin) has already asked for jQuery, then it will only be added once.

Using jQuery in a skin

In your skin’s main.tpl.php file, find this line:
skin_include( ‘_html_header.inc.php’ );
and right above it, add this:
require_js( ‘#jquery#’ );

Incompatible with Prototype

If your plugin uses [http://www.prototypejs.org/ Prototype], and another plugin on the same blog uses jQuery, there could be a conflict. The best practice is to port your code to jQuery. You’ll have less chance of conflict and better use of bandwidth. Otherwise, consult this [http://docs.jquery.com/Using_jQuery_with_Other_Libraries document about how to make them work together].

jQuery plugins


jQuery itself can be extended with [http://jquery.com/plugins/ plugins].

TODO: Work up some code that checks in the $required_js variable to see if the jQuery plugin has already been added by another b2evolution plugin.

Created by fatimahnasra • Last edit by fplanque on 2020-06-09 00:24 • •

No feedback yet

On this page

  • Using jQuery in a plugin
  • Using jQuery in a skin
  • Incompatible with Prototype
  • jQuery plugins

Search the Manual

Content Hierarchy

  • b2evolution CMS User Manual
  • User's Guide
  • Installation / Upgrade
  • Front-office Reference
  • Back-office Reference
  • Developer Reference
    • Website Skins/Themes
    • Email Skins/Themes
    • b2evolution Files
    • Website Integration
    • Plugins
    • Debugging
    • Technical Reference
    • Hacks
    • Credits
    • Development
      • CSS Guidelines
      • Crumbs (nonces)
      • Setting up a multidomain test environment
      • Roadmap & Unified Process
      • Coding Standard Guidelines
      • Ajax Debug Log
      • Debugging
      • Developer Setup
      • jQuery
      • Optimizing a SELECT Query
      • Dev Menu
    • How to... (Customize)
    • Scheduled Tasks Reference
  • Operations Reference
  • Advanced Topics
  • Glossary
  • Archives
Open-Source CMS

This online manual is powered by b2evolution CMS – A complete engine for your website.

About b2evolution

  • What is it?
  • Features
  • Getting Started
  • Screenshots
  • Online demo
  • Testimonials
  • Design philosophy
  • Free & open source
  • Terms of service

Downloads

  • Latest releases
  • Skins
  • Plugins
  • Language packs

About us

  • About us
  • Contact

Webhosting Guide

  • Web hosting blog
  • Best web hosting
  • Cheap web hosting
  • Green web hosting
  • Hosting with SSH
  • VPS hosting
  • Dedicated servers
  • Reseller hosting
  • Int'l: UK / France

Docs & Support

  • Online manual
  • Forums
  • Hire a pro !

Other

  • Adsense
  • Press room
  • Privacy policy

Stay in touch

  • GitHub
  • Twitter
  • Facebook
  • LinkedIn
  • News blog
  • RSS feed
  • Atom feed

Founded & Maintained by François Planque