Skip to main content
added 54 characters in body
Source Link
Derek Hogue
  • 17.4k
  • 2
  • 27
  • 42

We are utilizing a Matrix field to list information by date (each day has it's own row - first column being "date". We want only today's row to be displayed (similar to a calendar). HOWEVER, if an entry containing matrix rows - all of which are outdated, then a note to display "outdated" should appear.

Channel Entry : Department Channel Field : Calendar (Matrix) Columns: Date | Information

For entries that contain an updated monthly calendar, we are correctly identifying and displaying the single row with today's information using this code:

{calendar} {if "{date format='%Y%m%d'}" == "{current_time format='%Y%m%d'}"} {if} {/calendar}
{calendar}
    {if "{date format='%Y%m%d'}" == "{current_time format='%Y%m%d'}"}
        <information here>
    {if}
{/calendar}

BUT, we need it to be a conditional examination of the all of the matrix rows within the entry so that if none of the rows matches current_time, then a notice of "outdated calendar" displays.

Here's the catch - when we have used conditionals like the following, we get repeated display of "outdated" for every row that does not match today.

{calendar} {if "{date format='%Y%m%d'}" == "{current_time format='%Y%m%d'}"} {if:elseif "{date format='%Y%m%d'}" != "{current_time format='%Y%m%d'}"} {/if} {/calendar}
{calendar}
    {if "{date format='%Y%m%d'}" == "{current_time format='%Y%m%d'}"}
        <information here>
    {if:elseif "{date format='%Y%m%d'}" != "{current_time format='%Y%m%d'}"}
        <"Your calendar is outdated">
    {/if}
{/calendar}
Thus this results in 30 rows of "Your calendar is outdated" - instead of just one.

Thus this results in 30 rows of "Your calendar is outdated" - instead of just one.

We ONLY want one item displayed - either today's info (on a row that contains today's date) - OR outdated (if no rows match today's date)

Please help!

We are utilizing a Matrix field to list information by date (each day has it's own row - first column being "date". We want only today's row to be displayed (similar to a calendar). HOWEVER, if an entry containing matrix rows - all of which are outdated, then a note to display "outdated" should appear.

Channel Entry : Department Channel Field : Calendar (Matrix) Columns: Date | Information

For entries that contain an updated monthly calendar, we are correctly identifying and displaying the single row with today's information using this code:

{calendar} {if "{date format='%Y%m%d'}" == "{current_time format='%Y%m%d'}"} {if} {/calendar}

BUT, we need it to be a conditional examination of the all of the matrix rows within the entry so that if none of the rows matches current_time, then a notice of "outdated calendar" displays.

Here's the catch - when we have used conditionals like the following, we get repeated display of "outdated" for every row that does not match today.

{calendar} {if "{date format='%Y%m%d'}" == "{current_time format='%Y%m%d'}"} {if:elseif "{date format='%Y%m%d'}" != "{current_time format='%Y%m%d'}"} {/if} {/calendar} Thus this results in 30 rows of "Your calendar is outdated" - instead of just one.

We ONLY want one item displayed - either today's info (on a row that contains today's date) - OR outdated (if no rows match today's date)

Please help!

We are utilizing a Matrix field to list information by date (each day has it's own row - first column being "date". We want only today's row to be displayed (similar to a calendar). HOWEVER, if an entry containing matrix rows - all of which are outdated, then a note to display "outdated" should appear.

Channel Entry : Department Channel Field : Calendar (Matrix) Columns: Date | Information

For entries that contain an updated monthly calendar, we are correctly identifying and displaying the single row with today's information using this code:

{calendar}
    {if "{date format='%Y%m%d'}" == "{current_time format='%Y%m%d'}"}
        <information here>
    {if}
{/calendar}

BUT, we need it to be a conditional examination of the all of the matrix rows within the entry so that if none of the rows matches current_time, then a notice of "outdated calendar" displays.

Here's the catch - when we have used conditionals like the following, we get repeated display of "outdated" for every row that does not match today.

{calendar}
    {if "{date format='%Y%m%d'}" == "{current_time format='%Y%m%d'}"}
        <information here>
    {if:elseif "{date format='%Y%m%d'}" != "{current_time format='%Y%m%d'}"}
        <"Your calendar is outdated">
    {/if}
{/calendar}

Thus this results in 30 rows of "Your calendar is outdated" - instead of just one.

We ONLY want one item displayed - either today's info (on a row that contains today's date) - OR outdated (if no rows match today's date)

Please help!

Source Link

Conditional Examination of Dates within a Matrix Field

We are utilizing a Matrix field to list information by date (each day has it's own row - first column being "date". We want only today's row to be displayed (similar to a calendar). HOWEVER, if an entry containing matrix rows - all of which are outdated, then a note to display "outdated" should appear.

Channel Entry : Department Channel Field : Calendar (Matrix) Columns: Date | Information

For entries that contain an updated monthly calendar, we are correctly identifying and displaying the single row with today's information using this code:

{calendar} {if "{date format='%Y%m%d'}" == "{current_time format='%Y%m%d'}"} {if} {/calendar}

BUT, we need it to be a conditional examination of the all of the matrix rows within the entry so that if none of the rows matches current_time, then a notice of "outdated calendar" displays.

Here's the catch - when we have used conditionals like the following, we get repeated display of "outdated" for every row that does not match today.

{calendar} {if "{date format='%Y%m%d'}" == "{current_time format='%Y%m%d'}"} {if:elseif "{date format='%Y%m%d'}" != "{current_time format='%Y%m%d'}"} {/if} {/calendar} Thus this results in 30 rows of "Your calendar is outdated" - instead of just one.

We ONLY want one item displayed - either today's info (on a row that contains today's date) - OR outdated (if no rows match today's date)

Please help!