Hello
I have a view of nodes, with a date field. I have set the format of that date field to 'default', but would like to set it to a different format for specific node types.
So I hoped to do that in the views template (views-view-field--myview--field-date.tpl.php), and I started out with the code below:
// $Id: views-view-field.tpl.php,v 1.1 2008/05/16 22:22:32 merlinofchaos Exp $
/**
* This template is used to print a single field in a view. It is not
* actually used in default Views, as this is registered as a theme
* function which has better performance. For single overrides, the
* template is perfectly okay.
*
* Variables available:
* - $view: The view object
* - $field: The field handler object that can process the input
* - $row: The raw SQL result that can be used
* - $output: The processed output that will normally be used.
*
* When fetching output from the $row, this construct should be used:
* $data = $row->{$field->field_alias}
*
* The above will guarantee that you'll always get the correct data,
* regardless of any changes in the aliasing that might happen if
* the view is modified.
*/
$data = $row->{$field->field_alias} ;
print content_format('field_date', $data, 'mycustomformat') ;
But this doesn't work, it gives me the first of January 2009 on all dates, while $data returns values such as: 2005-07-01T00:00:00
How should I get the date field from the view in this template?
Thanks
Klaas
Comments
Comment #1
arlinsandbulte commentedHi,
I am just indiscriminately closing all support requests with no activity for more than 1 year.
If you consider this to still be a valid issue / support request, feel free to re-open.
BUT,
if you are re-opening this issue, please provide specific details on how this issue can move forward.
Thanks.
Comment #2
arlinsandbulte commented