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.

using expiration_date in date_heading

February 20, 2009 11:29am

Subscribe [2]
  • #1 / Feb 20, 2009 11:29am

    elemental

    77 posts

    Is it possible to use other date variables, than entry_date, week_date like edit_date, expiration_date or custom date in the date_heading?

    For example:

    {date_heading display="monthly"}
    <h1>{expiration_date format="%Y %m"}</h1>
    {/date_heading}

    or to be more a more precise example

    {exp:weblog:entries weblog="orders" orderby="expiration_date" sort="desc" show_expired="yes"}
        {date_heading display="monthly"}<h2>{expiration_date format="%F %Y"}</h2><p>{/date_heading}<br />
        {title}, ({expiration_date format="%d %F %Y"})</p>
    
    <p>{/exp:weblog:entries}

    This gives the right entries, but repeats the date heading in a sporadic way. Maybe I am missing something but I have tried this with custom date field, edit_date and as you see with expiration_date but it only works for me if used with entry_date.

    Any help or advice appreciated.
    Thanks

  • #2 / Feb 20, 2009 11:38am

    Ingmar

    29245 posts

    No, the date heading will only work with the entry_date. I suppose a few lines of PHP could do it (basically, in the case of “monthly” you’d want to write the month in a variable, then compare with the value from the previous round of the loop, and only print it if they are different—making sense?), otherwise I would recommend a feature request.

  • #3 / Feb 20, 2009 12:08pm

    elemental

    77 posts

    Thank you Ingmar. Will try withyn some llop and let you know how that went.

  • #4 / Feb 20, 2009 12:11pm

    Ingmar

    29245 posts

    Very good. Just let me move this over to Howto. Perhaps an FR might still be a good idea? 😊

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

ExpressionEngine News!

#eecms, #events, #releases