Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
KK,

I have the following code that I am using to show pages that have a status (editable radio button field in clonable template) of NOT "archive".

I then want to compare my input field called "end_date" with current date and if the end_date is less than (before) the current date, set the "status" of the editable input field to "archive" so it does not show up on the display page.

Code: Select all
<cms:pages masterpage='sale_template.php' show_future_entries='1' limit='100' paginate='1' custom_field="sale_month==October | status!==archive" order='asc' orderby='start_date'>

<cms:set sale_end="<cms:date end_date format='Y-m-d H:i:s' />" />
  <cms:set current_date="<cms:date format='Y-m-d H:i:s' />" />
 
  <cmsif: sale_end lt current_date><cms set status='archive'>
  </ cms:if>


Am I going about this the right way?

Thanks
set the "status" of the editable input field to "archive" so it does not show up on the display page
You'll have to do that in the admin-panel (or use DataBound Forms). Setting the value, as you are doing, in the cms:pages loop will amount to nothing.

That said, if archived pages is the page with 'end_date' less than current date, why don't you simply use that condition in cms:pages directly to skip pages that meet this criterion?

e.g. instead of this -
custom_field="sale_month==October | status!==archive"

- use this
custom_field="sale_month==October | end_date > <cms:date format='Y-m-d H:i:s' />"
2 posts Page 1 of 1
cron