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.

some trouble with random weblog entries...

August 26, 2010 7:13pm

Subscribe [2]
  • #1 / Aug 26, 2010 7:13pm

    Peter Ripley

    93 posts

    Have need to show some random entries and two aspects have me stumped.

    1. I would like to make two weblog:entries calls.  The first would display the 6 most recent entries.  The second would display 6 random entries but not any already displayed in the first call.


    2. For reasons that are too complicated to explain here I’d like to make a weblog:entries call that displays fields A and B from random entries.  Elsewhere on the page I’d like to make another weblog call to display to fields C and D from the same weblog entries displayed in the random call earlier on the page.

    Seem like in both cases that secret is to pass the entry ID’s from the first call into the entry_id=”” parameter in the second call.

    I’ve considered a bunch of ways to do this but haven’t come up with anything that I think will work.  Seems like the secret lies somewhere in the EE parse order.

    Was hopeful that exp:query would help but did not in my implementation.

    Would prefer not to have to write the SQL query in PHP if there is “an EE way”.  Am thinking that passing variables through an embed might work as well.  Neither of these solutions seem very elegant.

    Anybody handled something similar before?

    This is in EE 1.6.8.

    Many thanks!

  • #2 / Aug 27, 2010 10:21am

    Boyink!

    5011 posts

    Not sure I fully understand what you are trying to do, but a key hurdle I see is two separate weblog:entries loops that need to randomize in parallel.  They aren’t designed to see each other, so will each be randomizing leading to different results.

    I wonder if http://devot-ee.com/add-ons/reeposition/ would help in this case by letting consolidate those weblog:entries loops into one, yet use the different variables in different places.

  • #3 / Aug 27, 2010 10:47am

    Peter Ripley

    93 posts

    Thanks Boyink!, looks like that extension will be a big help with the second issue.

    The first one still has me stumped: need to display 6 random entries, other than the 6 newest ones…

  • #4 / Aug 27, 2010 11:11am

    Boyink!

    5011 posts

    Did you try using the offset parameter in addition to the random?  Never done it…but worth a shot.

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

ExpressionEngine News!

#eecms, #events, #releases