1

Sorry, I don't know how else to describe this (as in the title). So have you all seen Lumosity's logged-in user page? Basically, it shows a calendar with today's date (Sunday, for example), and games to play for that date. Then, when you login the next day, it'll show that it is Tuesday, and it'll give a selection of games to play for Tuesday.

Is there a way to do this with ExpressionEngine, where you pull and display random content each day (different content every 24 hours) from a channel (pool of content)?

Or to make it even more complex, say we want to display 5 content entries. How do we pull 1 entry from 5 different channels, so that the 5 content entries we want to display are all of different types?

Thanks.

0

You could build a simple add-on that extends the Channel Entry loop and sets the entry_id="" parameter based on the random ID's it grabs.

You could select the entry_ids to load with a method such as those found at https://stackoverflow.com/questions/18346047/select-record-from-database-randomly-based-on-time

You can read about extending Channel Entries here: http://dmlogic.com/blog/extending-the-expression-engine-channel-module/

So your add-on may look like this

{exp:date_entries channel="games" limit="5"}
    <li>{title} - <a href="/game/play/{url_title}/">Play now &raquo;</a></li>
{/exp:date_entries}

If you wanted to load from 5 different channels you could make your addon do that too by using a pipe delimiter so for example

{exp:date_entries channel="mind-games|trivia|technology|history|science|visual" limit="5"}

Your add-on would then run the SQL query against the channels listed above.

Let me know how you get on.

| improve this answer | |
  • Great answer, thank you! It won't be while until I try this hopefully, but if I can get it to work, I'll add a comment. – Omar Mar 10 '14 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.