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.

Expired Entries

January 20, 2011 11:01am

Subscribe [4]
  • #1 / Jan 20, 2011 11:01am

    shellfish

    48 posts

    Hey,

    I wonder if someone would kindly advise me on how I might achieve the following:

    I have a weblog for displaying ‘gig dates’  I am displaying all the gig dates on the page including past gig dates [i.e. expired entries].

    However, when a gig date has ‘expired’ I would like to dynamically display these with different CSS i.e. greyed out or striked through.

    Any ideas how I might achieve this?

    Thanks

    Shelley

  • #2 / Jan 20, 2011 5:39pm

    Sue Crocker

    26054 posts

    Hi, Shelly.

    Are you actually expiring the entries?

  • #3 / Jan 20, 2011 5:59pm

    shellfish

    48 posts

    Hi Sue,

    Yes, I want to expire the entries but still display them on the page. 

    I was just thinking about it some more wondering whether there might be a conditional statement I could use to check if an entry has expired and if so apply a class=“pastgig” or something along those lines so the expired entries can be styled differently?...

    What do you think ?

    Cheers Shelley

  • #4 / Jan 21, 2011 10:08am

    Ingmar

    29245 posts

    Yes, I want to expire the entries but still display them on the page.

    You know how to achieve that, I presume, using the show_expired parameter? Then simply use a conditional base on expiration_date:

    {if expiration_date != "0" && "{expiration_date format='%U'}" < "{current_time format='%U'}"} 
       This is a dead entry. Bereft of life, it has ceased to be.
    {/if}

    Makes sense?

  • #5 / Jan 21, 2011 11:18am

    shellfish

    48 posts

    So to add a class to the expired entries it would be:

    {if expiration_date != "0" && "{expiration_date format='%U'}” < “{current_time format='%U'}” class=“something”}
      This is a dead entry. Bereft of life, it has ceased to be.
    {/if}

    Correct?

    Thanks

  • #6 / Jan 21, 2011 11:44am

    Ingmar

    29245 posts

    No, more like

    {exp:channel:entries ...  show_expired parameter="yes"}
     ...
    <div{if expiration_date != "0" && "{expiration_date format='%U'}" < "{current_time format='%U'}"}
     class="foo"{/if}>
    {/exp:channel:entries}
  • #7 / Jan 21, 2011 3:18pm

    shellfish

    48 posts

    perfect! Thank you

  • #8 / Jan 22, 2011 3:29pm

    Greg Salt

    3988 posts

    Hi shellfish,

    Glad that Ingmar was able to help you with this. Please post back if required.

    Cheers

    Greg

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

ExpressionEngine News!

#eecms, #events, #releases