FullAjax library allows you to update more than one container through the implementation of it with two models of request – one request for one block and one request for multiple blocks. In the plugin Add FullAjax (2011.01.10) this feature is used to update the “Breadcrumbs” module. Of course instead of the “Breadcrumbs” module you can use any other, but only one – this is due to the fact that now I have not thought how to automate the setup process to upgrade several modules. Below a little instruction how to configure the update several modules through Ajax.

The theory. How to it work in FullAjax.

Suppose that we have three blocks, we need to update them simultaneously using Ajax.

1
2
3
<div id="menu">Here HTML code of the menu</div>
<div id="content">Here HTML code of the content</div>
<div id="baner_img">Here HTML code of the image</div>

First need say for FullAjax which the blocks need to update. For this we create model in to FullAjax configuration:

1
2
3
4
5
6
7
8
9
/* basic configuration */
SRAX.Filter.add({url:'/', id:'content'});
SRAX.directLink();
/* model */
SRAX.Model2Blocks['content'] = {
   'menu':'menu',
   'content':'content',
   'baner_img':'baner_img'
}

To make it work requires that the content that will give us the server was looks like follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
<!-- :ax:menu:begin: //-->
HTML code of the menu
<!-- :ax:menu:end: //-->
 
Everything between these blocks will be ignored.
 
<!-- :ax:content:begin: //-->
HTML code of the content
<!-- :ax:content:end: //-->
 
<!-- :ax:baner_img:begin: //-->
HTML code of the baner image
<!-- :ax:baner_img:end: //-->

So now we can update a few blocks at a time.

Practice. How to update more than one module with plugin Add FullAjax.

Little Step by Step Instructions :)

1. First need install “fullajax_tmpl” if not installed;

2. Then need set “update modules” to “manually” in plugin configuration;

3. Look positions where is shown modules (look in Module Manager)(Example: position-3, position-1, and user3.);

4. Find this positions in index.php of the template and add unique ID for each.
Example:

1
2
3
4
5
6
7
8
9
10
11
<div id="id-for-pos-three">
	<jdoc:include type="modules" name="position-3" />
</div>
	...
<div id="id-for-pos-user">
	<jdoc:include type="modules" name="user3" />
</div>
	...
<div id="id-for-pos-one">
	<jdoc:include type="modules" name="position-1" />
</div>

5. Add in to field “Js code, parameters for FullAjax”(advanced configuration) code for model:

1
2
3
4
5
6
7
/* model */
SRAX.Model2Blocks['forajax'] = {
   'id-for-pos-one':'id-for-pos-one',
   'id-for-pos-user':'id-for-pos-user',
   'id-for-pos-three':'id-for-pos-three',
   'forajax':'forajax'
}

forajax – it content ID.

6. Now need edit /templates/fullajax_tmpl/index.php . There need to add missing modules like next:

1
2
3
4
5
6
7
8
9
10
11
<!-- :ax:id-for-pos-three:begin: //-->
	<jdoc:include type="modules" name="position-3" />
<!-- :ax:id-for-pos-three:end: //-->
 
<!-- :ax:id-for-pos-user:begin: //-->
	<jdoc:include type="modules" name="user3" />
<!-- :ax:id-for-pos-user:end: //-->
 
<!-- :ax:id-for-pos-one:begin: //-->
	<jdoc:include type="modules" name="position-1" />
<!-- :ax:id-for-pos-one:end: //-->

7. That’s all :)

57 Comments to “ How to update more than one module with Ajax ”

  1. popo says:

    that’s right.
    I did it and works. but my modules, not loading in correct positions!
    It creates something below positions (modules not reloaded).

    Modules load under not their own so they have no class – no style. I have 2 module! one here:
    (I hope works!)

    main page


    another here:

    main page

    • popo says:

      again:
      Modules load under #div id=”forajax”# not their own #div id=”something”# so they have no class – no style. I have 2 module! one here:

    • Fedik says:

      think something missed …
      you not forgot about:

      /* model */
      SRAX.Model2Blocks['forajax'] = {
         'id-where-module':'id-where-module',
         'forajax':'forajax'
      }
      • popo says:

        Thank you for your answers!

        Wow!
        I must change “FullAjaxId” to “forajax”! May I need to change any other “FullAjaxId”? :) Should not it set automatically?
        I did some corrections to DIVs I added to template. Now, it works and homepage loads correctly (as before) and modules are in true IDs bet links, again, loads the “forajax” ID but positions loads without syling(no class=””). my right sidebar which should not be shown in some pages are visible(even empty).
        my breadcrumb not loading! :)

      • Fedik says:

        no, other “FullAjaxId” no need change .. in this article it was as example :)
        for sidebar you need use some HTM&CSS trick for hide it when there no content
        about breadcrumb have no idea :)

  2. popo says:

    Thank you again.
    I decided not to use FullAjax for Artister templates because modules without css styling are not good :) and I have no other free time to do experiment.
    I replaced FullAjaxId with forajax (my main ID) in Model2Blocks and It worked. but one empty Div pairs are responsible for my side bar.
    breadcrumb problem resolved adding aditional Div to it separating it from one other position.
    One major difference between artister (and some others) templates and simple ons, also, what I think make FullAjax load component and messages correctly and positions without css class (in their DIV) is that artister ask for components using
    #Jdoc:include type=”component”#
    and for positions (modules):

    #?php
    if ($view->containsModules('breadcrumb'))
    echo
    artxPost($view->position('breadcrumb')); ?#

    ( replaced with #) :)

    and FullAjax not!
    Maybe, later.
    Regards.
    Maybe it is true or not! I don't know.

  3. Alexander says:

    I guess there is much to do and no free time right? :D
    Anyway i have noticed a bug with non utf-8 urls and 404 errors with full ajax… the urls was with Greek chars, if you would like i can give u url…

    There is also one question i have about the plugin, i have a module that places links like your blogs reply ones.. mine have id like “idname”++number (each time the element gets new uniue id). How could i block these from fullaxaj? is there a way to block via class? or something like “return ops.el.id != ‘idname*'; “

    • Fedik says:

      yes, you are right .. I have not to much free time now ;)
      problem with some special chars I noted only in IE, in this time .. but maybe will need more test

      about ignore some link by block id, try something like:

      ...
      var parent = ops.el.parentNode.parentNode.id;
      if(parent.indexOf('idname-') !== -1){
                  return false;
              }  
      ...

      here is need check, how much “parentNode” you need …

      about, “by class” not sure, but can be something similar

  4. carlos says:

    Fedir, okay, so I explained to you, but not updated the modules, I’m using templante beez20 joomla 2.5. The code I’m using and the following

    / * Basic Configuration * /
    SRAX.Filter.add ({url: ‘/’, id: ‘forajax’});
    SRAX.directLink ();
    / * Model * /
    SRAX.Model2Blocks [‘forajax’] = {
    ‘main’, ‘main’,
    ‘top’, ‘top’,
    ‘forajax': ‘forajax’
    }
    ————————————————– ————————————
    the template tmpl put right after the code

    <-: X: get (‘fullAjaxContId’, ‘forajax’);?>: End: / / -> then put this

    and the modules do not update at all
    What can I do for this to work?

    • Fedik says:

      songs like you did something wrong, but i cannot understand what :)
      ps. use <code>, or <pre> tag for you code in comment ;)

  5. Dan says:

    Hi,

    and thanks alot for this nice plug-in.

    Unfortunately I’ve got the problem, that the module “showplus”, which I use for a gallery, doesn’t load properly since I’ve istalled fullajax.

    Whenever I reload the page with F5 the showplus gallery loads correctly and works just fine, but opening this page via menu-item, it won’t.

    The showplus module is placed via {loadposition}.

    Do you have any suggestions?

    Many thanks in advance,
    Dan

  6. Fettbein says:

    Thanks a lot for this great plugin!!
    I’m just in trouble with the semi automatically update of my position. My breadcrump is updated but empty instead of being chaged to the right path.
    Any suggestions?

  7. JCC says:

    Hi im joomla newbie and im starting to create a website but really like your plugin and wanna implement it , but so can u tell me the easiest joomla framework that u have tested to use your plugin. so i could get a template of that framework.

    im going to create a music site and need my mp3 player keep playing while the user navegate without using iframes or a popup player.

    ty

    • Fedik says:

      worked with the default template, as you can see on demo site…
      you will get less problem with self made template or with a template created by Joomla way Template_Development

      • JCC says:

        Ty for your fast reply, thats a great idea but the default template doesnt look ok and create a new one is mmmmm i think i will try using a framework template but looking for the want that will get me less problems?

      • Fedik says:

        unfortunately I cannot tell you what framework will make a less problem … cause I do not know ;)

  8. Дмитрий says:

    Здравствуйте.

    Будьте добры, подскажите, в чем я ошибаюсь? Перерыл уже все что можно – не могу найти причину.

    Дано:

    Стандартный сайт с демо-данными – http://test.skmaximum.ru.preview.ihc.ru/ .

    Установленный addfullajax_2012.10.14. Контент находится в id=”main”

    Настройки плагина:

    Enable Positions update – Yes, semi-automatically
    Content CSS id – main

    Ignore menu items – Home
    Do not use FullAjax on – Home

    Область контента подгружается с шаблоном. Для пункта меню Home аякс отключен, однако все равно срабатывает.

    Подскажите пожалуйста, куда копать? Уже все поперепробовал что можно.

    Спасибо.

    • Fedik says:

      ошибка: “Ignore menu items – Home”
      Home – ето корень сайта, по етому, если SEF включено то будут игнорироваться все дочерние страници,

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>