Add a date form
Permalink Browser Info Environment
I have looked at designer-content for a couple of hours and I like it as I´m new to Concrete5.
It makes allot of things much more easy.
I do miss one thing.
I would like the ability to add a datetime field from a calender dropdown.
Since that function is included in the core it might not that hard to do (I don´t know!)
Something to think about in future upgrades.
It makes allot of things much more easy.
I do miss one thing.
I would like the ability to add a datetime field from a calender dropdown.
Since that function is included in the core it might not that hard to do (I don´t know!)
Something to think about in future upgrades.
Type: | Discussion |
---|---|
Status: | New |
Thanks for a quick reply!
That worked like a charm.
It´s only 2 blocks I´m planning to add this to so it´s no problem to do it manually.
I just had to refresh the block from the dashbord to update the db after I made the edits to the files.
If someone else use this solution, EDIT.PHP have 2 echo, it should only be one.
change from:
In edit.php, wherever you want the calendar control to appear, add this:
to:
In edit.php, wherever you want the calendar control to appear, add this:
That worked like a charm.
It´s only 2 blocks I´m planning to add this to so it´s no problem to do it manually.
I just had to refresh the block from the dashbord to update the db after I made the edits to the files.
If someone else use this solution, EDIT.PHP have 2 echo, it should only be one.
change from:
In edit.php, wherever you want the calendar control to appear, add this:
to:
In edit.php, wherever you want the calendar control to appear, add this:
<div class="ccm-block-field-group"> <h2>Date</h2> <?php echo Loader::helper('form/date_time')->date('date_field', $date_field); ?> </div>
I do not think I want to add this field because it is not a very common thing that people need. If you would like to add this to your own block, you can do so by adding the following code to several of your block files:
In db.xml, just ABOVE the line containing '</table>', add this:
In controller.php, inside the 'save' function (just ABOVE the line containing 'parent::save($args);'), add this:
In edit.php, wherever you want the calendar control to appear, add this:
In view.php, wherever you want the date to be outputted, add this:
(note that the 'F j, Y' above formats the date like 'January 1, 2011' -- see http://php.net/date for other formatting options)
Thanks for the feedback, and I hope this helps.
-Jordan