Thread tagged as: Question

Auto change date

Is it possible to automatically update a date in a multi-region item without going into the region, changing the date and saving it?

The client is a recruiter and wants to be able to post a job on their site with a posted date that updates itself after a week with that day's date.

I suspect I already know the answer, just asking for a friend :)

John Robinson

John Robinson 7 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

It's not possible to update the date in the region, but you don't have to display the date that's stored. You could calculate the date you display dynamically.

Ok, so I could take the date in that region, add seven days to it and output it as a variable using PHP?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Use the date as a 'created date', and then I'd write a template filter to do whatever transformation is required as it's output, based on the current date.

Thanks Drew, I'll look into it.

I would have probably thought Javascript John – unless you run a CRON on the php page to refresh the data every day. But I might be, and normally am, wrong!

Hope all is well btw.