There are certainly some concepts there I didn't realise could be applied to this situation. Thanks - this has been really useful.

I can now have the publish date showing in my form for this template using this code within my template:
Code: Select all
<cms:config_form_view>
      <cms:field 'k_publish_date' label = "Start Date" format='dmy' fields_separator=',' default_time='@current' group='irregular_details'  />
   </cms:config_form_view>


This turned out not to be ideal, though, on further thought - it means bringing the 'published/unpublished' field into 'normal' form view, and because I have the start date within a section, if anyone did want to create an unpublished regular event, they'd (counterintuitively) have to find that setting in the 'special events' group. It also doesn't respect the date format setting.

However there is what looks a better way. I believe that if I put this into my template:
Code: Select all
   <cms:config_form_view>
      <cms:persist
        k_publish_date="<cms:if k_publish_status='0'>0000-00-00 00:00:00<cms:else/><cms:if frm_frequency><cms:date '<cms:show frm_frequency> of August 2010' format='Y-m-d H:i:s' /><cms:else/><cms:show frm_start_date /></cms:if></cms:if>"
    />
   </cms:config_form_view>


that should set the publish date to:
  • A 'zero' date if the item is unpublished
  • A suitable date in August 2010 if it's has the 'frequency' field filled in
  • Or the contents of the start_date field if it's a special event

But I seem to have hit an issue with <cms:date> . If I put this code into a page:

Code: Select all
<p>
    Date without variable:
         <cms:date 'First Saturday of August 2010' format='Y-m-d H:i:s' />
</p>
<cms:set my_date ='First Saturday' />
<cms:set my_date2='First Saturday of August 2010' />
<p>
    Date with short variable:
   <cms:date '<cms:show my_date /> of August 2010'  format='Y-m-d H:i:s'/>
</p>
<p>
   Date with full variable: <cms:date '<cms:show my_date2 />'  format='Y-m-d H:i:s'/>
</p>


then the first one works, and produces the right date, but the others (involving variables being used within <cms:date>) don't - they produce a (PHP) zero date.

Am I doing something wrong, or is this a bug in the date function?

EDIT: I've now tried using
Code: Select all
<cms:php>
    echo(date('Y-m-d H:i:s',strtotime( '<cms:show my_date /> of August 2010')));
</cms:php>

instead of the cms:date function in the code above, and that works fine. This gives me a workround for the cms;Date oddity in my own case, and I'll put something on the bugs board about that issue.