ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

orderby="random" is not very random when limit applied

July 17, 2012 8:41am

Subscribe [3]
  • #1 / Jul 17, 2012 8:41am

    GabbaTheHutt

    84 posts

    Hi there

    I have four adverts in a channel which is limited to two adverts on a page. These adverts should change every time the page is loaded.

    I have applied orderby=“random” to the list and set limit=“2”. The result is that two adverts will appear and change places when the page is reloaded, but only those two adverts. The other two adverts don’t show on that page. They will show on certain pages, but again, two adverts will show, but only those two. Their positions will change, but the adverts will not change.

    Why is this? And how can I get all four adverts to show up randomly on each page?

    Many thanks
    Gabe

  • #2 / Jul 17, 2012 11:18am

    Rob Allen

    3114 posts

    Make sure you aren’t caching the template that holds your ads.

    Sometimes “random” is just that, it won’t necessarily mean you get different results on each page refresh.

  • #3 / Jul 17, 2012 12:01pm

    GabbaTheHutt

    84 posts

    I have checked that and I have refreshed the page enough times that it couldn’t possible be “randomly” picking the same two adverts. I and my client have both tested it.

    It is definitely an issue with the limit and the orderby=“random” functionality not working properly.

  • #4 / Jul 17, 2012 4:53pm

    Shane Eckert

    7174 posts

    Hello GabbaTheHutt,

    I am sorry to hear you are running into this problem.

    Can you please tell me what version of ExpressionEngine you are currently running?

    Can you show me the template code for this page? I would love to see the code you are talking about in particular.

    Sometimes you can set random but if you have other parameters enabled in your channel entries tag, that will hinder the ability to show random. Is this an entry that should not be dynamic? It sounds like it.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases