Jahia Template Forum > Using random container...

0 (0 Good)
0 (0 Bad)

Using random container inside a box (Jahia 6)

by  equinox »  2011/06/07 20:01

Hi,

I'm trying to setup a page that has 3 randomly selected items appearing in a side box. To do this I've been using the newsDisplay example from the web_templates to select the data held on a different page.
So using this gives me a list of the people:

[code:3m0c25qg]lt;template
  • Using random container inside a box (Jahia 6)
    2011/06/07 20:01

    equinox Hi,<br/><br/>I'm trying to setup a page that has 3 randomly selected items appearing in a side box. To do this I've been using the newsDisplay example from the web_templates to select the data held on a different page. <br/>So using this gives me a list of the people:<br/><br/>[code:3m0c25qg]lt;template

  • Number of messages  6
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Using random container inside a box (Jahia 6)

    by  dsaulnier »  2011/06/07 20:01

    Hello,

    There is a similar thread: [url:28xp4qn0]http#58;//www

    Damien Saulnier (dsaulnier)

    Number of messages  31
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re: Using random container inside a box (Jahia 6)

    by  equinox »  2011/06/07 20:01

    Hi Damien,

    Yes I`d seen that thread thanks. I`m using Jahia 6 EE edition, but I`ll probably try upgrading to SP1 soon.

    The thing is when I try to use the random tag with the side box code as per the news example in the web_templates example I end up with just one div to be randomly selected - is this a product of using the containerQuery? i.e. I end up with this HTML:

    [code:njagm7ye]lt;div class=
  • Re: Using random container inside a box (Jahia 6)
    2011/06/07 20:01

    equinox Hi Damien,<br/><br/>Yes I`d seen that thread thanks. I`m using Jahia 6 EE edition, but I`ll probably try upgrading to SP1 soon.<br/><br/>The thing is when I try to use the random tag with the side box code as per the news example in the web_templates example I end up with just one div to be randomly selected - is this a product of using the containerQuery? i.e. I end up with this HTML:<br/><br/>[code:njagm7ye]lt;div class=

  • Number of messages  6
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Using random container inside a box (Jahia 6)

    by  pap@commaro.com »  2011/06/07 20:01

    Hello,

    yes, you are right. With the randomContainer tag all the containers are sent to the client and then a Javascript function randomly decides, which one should be displayed. So this implementation suits only small containers (e.g. a few random ads or banners to randomly chose from).

    If you have many containers, you would need to the random contianer picking on server side, but you will need to switch off the container HTML cache for this fragment.

    Regards,
    Benjamin

    Benjamin Papez (pap@commaro.com)

    Number of messages  220
    Registration date
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page