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.

Load different paragraphs on each page load?

September 25, 2007 10:15pm

Subscribe [5]
  • #1 / Sep 25, 2007 10:15pm

    mstatesynergy

    2 posts

    Is there a way to dynamically load a different paragraph or content piece on each page load?

    Thanks,
    Nelson

  • #2 / Sep 25, 2007 10:28pm

    Sue Crocker

    26054 posts

    Are you talking about a random quote or some such thing?

  • #3 / Sep 26, 2007 8:11am

    mstatesynergy

    2 posts

    Yes, like a random quote.

  • #4 / Sep 26, 2007 8:18am

    silenz

    1651 posts

    The way I’d prefer would be using a weblog for storing the random content bits, each in its own entry.

    Then just use

    {exp:weblog:entries weblog="whatever" limit="1" dynamic="off" orderby="random"}
    {your_field}
    {/exp:weblog:entries}

    There are also two randomizer plugins available that could be used for things like this but the weblog-approach is probably the most flexible.

  • #5 / Oct 07, 2007 12:43am

    maadmac

    224 posts

    {exp:weblog:entries weblog="whatever" limit="1" dynamic="off" orderby="random"}
    {your_field}
    {/exp:weblog:entries}

    This is exactly what I’m looking for, as well.  I used exactly the code that silenz posted here, but for some reason the page displays the same one entry always, no matter how many times I refresh the page.  Any ideas offhand why that may be?

    Here’s the code I’m using, verboten:

    {exp:weblog:entries weblog="testimonials" dynamic="off" orderby="random" limit="1"}
                
    <h4>“{mini_quote}”</h4>
    <p>{testimonial_name}<br />
    {testimonial_company}<br />
                <br />
    {/exp:weblog:entries}

    I’ve got a weblog called ‘testimonials’ that I want to randomize.  Here’s the kicker:  if I change any parameter—like, say, make it limit=“2”—it will display a different two, but always those two.  If I change something else, it changes again but then stays static.

    As best as I can figure it, it may have something to do with the cache.  But as per Lisa’s suggestion, I deleted everything in the cache and made sure that its permissions are set properly and still no go.

    Thanks!

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

ExpressionEngine News!

#eecms, #events, #releases