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.

Weekly entry display rotation

July 04, 2012 4:47am

Subscribe [2]
  • #1 / Jul 04, 2012 4:47am

    pushloop

    422 posts

    Hmm, not sure if the post title made any sense…

    I’m in need of some assistance with an idea I have for a website we’re currently working on.

    Basically we’re gonna have a bunch of staff interviews on the site, which will be submitted as separate channel entries, and we would like to display and automatically rotate these interviews on a weekly basis, starting when the first entry is submitted.

    The thing is, we don’t want to have to create these entries once a week, or set an entry date in the future, we would like to be able to create multiple interviews without having to set unique entry dates - we would like to change entry each week in the order they were created and then have them start over from the first entry after the last entry has been shown.

    Example:
    Interview 1 - Week 34
    Interview 2 - Week 35
    Interview 3 - Week 36
    Interview 4 - Week 37
    Interview 5 - Week 38
    Interview 6 - Week 39 (last entry - now we start over from the first entry)
    Interview 1 - Week 40
    Interview 2 - Week 41
    Interview 3 - Week 42
    Interview 4 - Week 43
    Interview 5 - Week 44
    Interview 6 - Week 45
    Interview 7 - Week 46 (this new entry has been added sometime during the last 6 weeks)
    Interview 1 - Week 47
    Interview 2 - Week 48
    and so on…

    I really have no idea where to start on this one or if it’s even possible to achieve this kind of automation, so all thought and/or ideas are more than welcome!

    /André

  • #2 / Jul 09, 2012 4:35pm

    ChiefAlchemist

    913 posts

    Off the top of my head.

    Set up a PHP array. The index/key is the week of the year (1 - 52). The value would be the URL or the entry id of the interview for that week.

    Then use PHP to get the week of the year. Slap that into the array to get the entry you need, look up the entry. Done.

    While I understand you were probably looking for how to loop a universe of (for example) 35 interviews. This is not that 😊 But it’s a start.

    If you knew how many weeks you are from some base week I’m sure there’s some math / algorithm magic that can turn that into some cycle of 35.

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

ExpressionEngine News!

#eecms, #events, #releases