In some of the content type I have a field date with collects start date and end date. The end date is not required and is empty as default value.
When I show date in teaser or node or view it will show start and end date but I want a condition
if (empty($end_date)) {
print "current";
} else {
print $end_date;
}
of course I can set it in the node.tpl.php, for the teaser and the node, and with alternative text if empty in the views with field setting.
Now would like to know if there is any way to do it with the API. Something I can do in the template.php and not in every single node--CONTENT-TYPE.tpl.php and in every single view.
I'm looking for something like
function my_module_date_api ($something) {
if (empty($end_date)) {
print "current";
} else {
print $end_date;
}
}
Thanks in advance