ajax

Ajax may refer to: read more at WikiPedia

  • IBM has put an interesting online article about  DWR (Direct Web remoting) technology...

    In the simplest terms, DWR is an engine that exposes methods of server-side Java objects to JavaScript code. Effectively, with DWR, you can eliminate all of the machinery of the Ajax request-response cycle from your application code. This means your client-side code never has to deal with an XMLHttpRequest object directly, or with the server's response. You don't need to write object serialization code or use third-party tools to turn your objects into XML. You don't even need to write servlet code to mediate Ajax requests into calls on your Java domain objects.
    Read more at IBM developerworks
  • In this series of post I will outline some common techniques to help Joomla extensions development.

    As you know Joomla is shipped with Mootools library which assign $ also to Ajax. Here is 2 tips that will allow you to use jQuery scripts without any modifications (most of the time you will find tips to assign jQuery to something else than $ and rewrite your scripts)

    First it is recommended to include always mootools first to avoid jQuery conflict issues

    JHTML::_('behavior.mootools');
    $document = JFactory::getDocument();
    $document->addScript(JURI::root() . "media/com_cedtag/js/jquery.1.7.2.min.js");

    then to run jQuery in noConflict mode. Note that here I do not assign jQuery to any alias.

    $document->addScriptDeclaration("jQuery.noConflict();");

    Till here, this is what you will find on all Joomla forums, posts over the internet. The last tips is what make the difference!

    Instead of using a different alias for the jQuery object (when using noConflict), you can write your jQuery code by wrapping it all in a closure. This can be done in the document.ready function

    $script = "jQuery(function($) { $();

    });"; $document->addScriptDeclaration($script);

    This way you are not force to rewrite your scripts to use another alias (replacing $ with jquery alias for example in all your scripts). This make inclusion of jQuery really easy!

    Happy Coding!

  • joomla_cms

    jocomment I did install yesterday evening the latest version of !JoomlaComment

    !JoomlaComment is one of the first extensions for Joomla,that let you comment under articles.

    The !JoomlaComment system can be installed on any joomla website within seconds! Make
    your website more interactive!

    Main Features:

    • ajax-based
    • captcha protection
    • akismet support
    • ubb code support
    • threathed/nested comments
    • multilanguage support
    • mail, website input
    • See more features here

    Joomla support templates, depending on which templates you use

    • MTdefault-emotop, these templates MTxxxx use mootols 1.11
    • JQdefaut-emotop, these templates JQxxxx use Jquery
    • ..

    You may behind the scene include another additional AJAX library in Joomla!® frontend, this lead to performance issues:

    If !JoomlaComment use JQuery 1.1.4 and not the AJAX library of Joomla!, aka Mootools 1.11. Another huge JavaScript files that make my server busier!

    Since any static files can be offloaded to another server to gain more speed. For example, any static images, JavaScript or CSS files can be moved to a different server for more speed.

    In order to be able to offload this JavaScript library to Google code, you’ll have to do the following:

    In the template you are using, for example in components/com_comment/joscomment/templates/JQdefault-emotop/index.html

    Search for

    {library}
    <script type="text/javascript" src="components/com_comment/joscomment/jscripts/jquery-1.1.4.pack.js"></script>
    <script>jQuery.noConflict();</script>
    {/library}

    and replace with

    {library}
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> 
    <script>jQuery.noConflict();</script>
    {/library}

    Note that I use here the latest JQuery version (1.3.2) and not the default version of !joomlaComment (1.1.4), here is why

    • This version 1.1.4 is not available at jquery">http://code.google.com/apis/ajaxlibs/documentation/jquery :-)
    • I did test the frontend of !JoomlaComment 4.0 with JQuery 1.3.2 and it work great

  • I am restarting the development of OpenComment, and found  that the existing code wont be practical without using AJAX. That's why I am now integrating AJAX in openComment where it make sense:
    • Comments rating,
    • Comments filtering,
    • Administration function.

    After looking on the market which framework can help me to achieve these goals, I found xajax 0.2.4

    is an open source PHP class library that allows you to easily create powerful, web-based, AJAX applications using HTML, CSS, JavaScript, and PHP. Applications developed with xajax can asynchronously call server-side PHP functions and update content without reloading the page.

    The xajax PHP object generates JavaScript wrapper functions for the PHP functions you want to be able to call asynchronously from your application. When called, these wrapper functions use JavaScript's XMLHttpRequest object to asynchronously communicate with the xajax object on the server which calls the corresponding PHP functions. Upon completion, an xajax XML response is returned from the PHP functions, which xajax passes back to the application. The XML response contains instructions and data that are parsed by xajax's JavaScript message pump and used to update the content of your application.


  • joomla_cms

    I did optimize a bit my Joomla! homepage in the last few days. This has been achieved with

    • Enabling Joomla module caching in all 3rd party module where it was missing/ not implemented at all,
    • Starting to offload some assets (JavaScript) to faster hosting,

    Click read more to apply the same for your internet site.

    Use Joomla Module caching

    Not all 3rd party Joomla modules are using caching. This means that in worst case, some Joomla! modules may create way too much SQL queries. A way to reduce the load is to activate module caching. You’ll have to go through all 3rd party modules and check that they have in their administrator panel a setting to enable/disable cache.

    jooomla.enable.caching

    You’ll see that 90% of all modules (except official Joomla! modules which are able to deal with caching) are NOT supporting caching. We will change that now:

    For every module without cache, open the xml file at /modules/mod_xxxxxxx/mod_xxxxxxx.xml and add between <params> .. </params>

    <param name="cache" type="radio" default="0" label="Enable Cache" 
           description="Select whether to cache the content of this module">
     <option value="0">No</option>
     <option value="1">Yes</option>
    </param>

    Note that if <params> .. </params> do not exist, just add it like below

    <params>
     <param name="cache" type="radio" default="0" label="Enable Cache" 
           description="Select whether to cache the content of this module">
      <option value="0">No</option>
      <option value="1">Yes</option>
     </param>
    </params>

    Visit or reload the admin panel of that module and set the Enable Cache to Yes.Click Save/Apply at least once.

    Now the output of this module will be saved in /cache and only refresh when global Joomla cache timeout (900 seconds as default). Consider also contacting the author of the module so he can patch his code.

    Offload assets

    Offloading assets (JavaScript, static images, static files) can bring tremendous speed gains, at the cost of resolving more DNS name. Using this technique will help your Apache concentrate on php instead of streaming static data.

    Offload JavaScript

    When you look at Joomla! frontend source code, you will see that the JavaScript library mootols.js is 74kb big. Google is offering to host all major AJAX  libraries free of charge at http://code.google.com/apis/ajaxlibs/documentation/ so why not profiting of their datacenter speed/bandwidth/response time?

    Now the dirty part, You can’t tell Joomla! not to include the mootols.js from /media/system/js/mootools.js at rendering time. We will have to patch the code of Joomla!

    open /libraries/joomla/html/html/behavior.php and search for

    if ($debug || $konkcheck) {
      JHTML::script('mootools-uncompressed.js', 'media/system/js/', false);
    } else {
     //JHTML::script('mootools.js', 'media/system/js/', false); // old Joomla code
     JHTML::script('mootools-yui-compressed.js', 'http://ajax.googleapis.com/ajax/libs/mootools/1.11/', false);
    }

    Joomla use mootools.js in version 1.11, don’t use the latest version (1.2.3) as most Joomla! plugin wont work (but your mileage may vary).

    To be continued

  • Following the Preview of SecurityImages 5.2.0, I am currently developing a proof of concept using the Ajax library JQUERY 

    jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.

    smallbox_securityimages

    I want to allow generated captcha to be checked asynchronously without needing submit of whole page. This is a major complain since the beginning of SecurityImages, as currently users lost their entries in the form in case the captcha challenge get refused.

    A lot more check are also done NOW in the Diagnostics page:

    • Checking existence of system plugin,
    • Ability to display the error message if any of each plugin in one click
    • Reload count configured will be displayed,
    • A way to create automated error reporting (cut and paste) for better support in my forums

    AND

    A new API inspired from recaptcha.net that will allow me to integrate new system in future without being limited to an image (why not having a flash or video in future?). This API fully use the Joomla! event system so less code to write for all 3rd party developers and less dependencies.

    Stay tuned!