Forum for discussing general topics related to Couch.
2 posts Page 1 of 1
I know we can show/hide some editable fields on backend using the cms:func together with the not_active attribute. However, let me explain what I want to do to see if I can achieve this:

I have a page called students.php, which contains a field to enter his grade. However, I want to hide this field if the current time is between, let's say, 20:30 and 08:00.

I know that, with conditional fields, depending of which options we select, we can trigger the hide/show on subsequent fields. However, can I do the same just based on the current time? How?
I think you can safely go with PHP's strtotime -

Code: Select all
echo @strtotime( 'today 20:45' );
echo @strtotime( 'tomorrow 08:00' );
echo @strtotime( 'now' );


All resulting times will be in seconds (UNIX format) and thus easily comparable. :) The result of comparison will determine "hide" / "show" condition.
2 posts Page 1 of 1
cron