Member
Member
walterbz   2013-08-23, 21:14
#1
I was looking for a way to display the exif date in the european format:
day-month-year hour:minute instead of year-day-month

Since I didn't found a setting or a solution I made a little mod in the template-function.php line 2387 and below.

Original:
`
<?php
foreach ($exif as $field => $value) {
$label = $_zp_exifvars[$field][2];
echo "<tr><td class=\"label\">$label:</td><td class=\"value\">";
echo html_encode($value);
echo "</td></tr>\n";
}
?>
`
modified:
`
<?php
foreach ($exif as $field => $value) {
$label = $_zp_exifvars[$field][2];
echo "<tr><td class=\"label\">$label:</td><td class=\"value\">";
if ($field=="EXIFDateTimeOriginal" || $field=="EXIFDateTime"){
$date = new DateTime($value);
echo date_format($date, 'd/m/Y H:iConfused');
}else{
echo html_encode($value);
};
echo "</td></tr>\n";
}
?>
`
I know that is not a good solution to modify the core files. Every update I must remember to do the same mod.
It would be nice to modify the code with a variable setting in admin (the date format 'd/m/Y H:iConfused') so it would be possible to customize as needed.

Perhaps there is another "cleaner" solution. In case let me know, Thank you
Walter
Member
Member
sbillard   2013-08-23, 22:01
#2
Your code looks reasonable. Of course you need not modify the core, you can simply make your own print function under a different name by copying the code then modifying it.

There is a define for the data format set for the site: `DATE_FORMAT`.

Probably the cleanest solution would be to add formatting information to the `$_zp_exifvars` array and use that in the output function.
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.