Change date

Permalink Browser Info Environment
When clicking on a event and it shows all items the date is set like this: "2014-12-01" I would like to have it like this: "01-12-2014"

I already set the following code in site.php
define ('APP_TIMEZONE', 'Europe/Amsterdam');
define ('DATE_DEFAULT_TIMEZONE_SET', 'Europe/Amsterdam');
define('DATE_APP_GENERIC_MDY', 'j-m-Y');
define('DATE_APP_GENERIC_MDY_FULL', 'd F Y');
define('DATE_APP_GENERIC_MDYT', 'j-m-Y \a\t H:i');
define('DATE_APP_GENERIC_MDYT_FULL', 'd F Y \a\t H:i');
define('DATE_APP_GENERIC_T', 'H:i');
define('DATE_APP_GENERIC_TS', 'H:i:s');
define('DATE_APP_DATE_PICKER', 'dd-mm-yy');
define('DATE_FORM_HELPER_FORMAT_HOUR', '24');


How to manually set it in this code?
<?php      
// get list of items with the display_in_surefyre_calendar set
Loader::model('page_list');
$pl = new PageList();
$pl->filterByAttribute('display_in_surefyre_calendar', 1, '=');
$pages = $pl->get($itemsToGet = 1000, $offset = 0);
$textHelper = Loader::helper("text");
$imgHelper = Loader::Helper('image');
// collate dates
$dates = array();
foreach($pages as $page) {
   $nh = Loader::helper('navigation');
   $link = $nh->getLinkToCollection($page);
   $date = preg_replace('/ .*/', '', $page->vObj->cvDatePublic); // drop time portion of datetime
   $dates[$date][] = array($link, $page->vObj->cvName, $page->vObj->cvDescription);


Thanks for your help

Type: Discussion
Status: New
studio4graphics
View Replies:
surefyre replied on at Permalink Reply
surefyre
In line 167 of /packages/calendar_nav/blocks/calendar_nav/view.php, change
$date to e.g. date('d-m-Y', strtotime($date))

Best to create a custom view with the mod rather than edit the source in
packages.

G

Linked In <http://uk.linkedin.com/in/guyeastwood> - G+<http://plusya.com/guy>
- Fonovation Limited <http://www.fonovation.com> - Surefyre
Design<http://www.surefyre.com>


On 17 January 2014 10:43, concrete5 Community
<discussions@concretecms.com>wrote:
studio4graphics replied on at Permalink Reply
studio4graphics
Thanks for your reply.

I get an error:
Fatal error: Can't use function return value in write context in /home/studio4/domains/studio4graphics.nl/public_html/voorbeeld/c5-2/blocks/calendar_nav/templates/uitkalender/view.php on line 167
/////////////////////////// begin list option output
   foreach($dates as date('d-m-Y', strtotime($date))=>$pages) {
      if(strtotime($date) == strtotime($_REQUEST['d'])) {
         echo'<div class="surefyre_calendar_list_date">' . $date . '</div>';
         foreach($pages as $page) {
            echo'<div class="surefyre_calendar_list_item">';
            echo'<div class="surefyre_calendar_list_item_name"><a href="' . $page[0] . '">' . htmlentities($page[1], null, "UTF-8") . '</a></div>';
            echo'<div class="surefyre_calendar_list_item_desc">' . htmlentities($page[2], null, "UTF-8") . '</div>';
            echo'<div class="surefyre_calendar_list_item_desc_more"><a href="' . $page[0] . '">Lees meer</a></div></div>';
         }
         echo'<div class="scliblk"></div>';
      }
   }
?>


What did I do wrong.

Thanks for your time!
surefyre replied on at Permalink Reply
surefyre
Make an intermediate step if you get that error, it's usually from using a
function as part of a calculation, often in an if statement

e.g.
instead of if($a = somefunc($val)) { ... }

do: $a = somefunc9$val);
if($a) { ... }

G

Linked In <http://uk.linkedin.com/in/guyeastwood> - G+<http://plusya.com/guy>
- Fonovation Limited <http://www.fonovation.com> - Surefyre
Design<http://www.surefyre.com>


On 17 January 2014 11:33, concrete5 Community
<discussions@concretecms.com>wrote:

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.