I have a newspaper website in development. I would like the articles that are published show the published time in the dateline and when an article is updated to show the time of the update. There is a lot of grey area about this. Does publishing and unpublishing then publishing again constitute an updated article on a newspaper website because there has been no changes to the text?
Here is the byline code modified from OpenPublish (which I'm not using.) . I am worried that I will not get this to work smoothly. Quite often a reporter or editor will change and edit an article once it's been published within the first twenty for hours. I think that half the articles will show updated because of that when it was most likely one little typo. How does a major change to a story or mistake corrected get labeled online? Does anybody have any ideas?
/**
* Format the "Submitted by username on date/time" for each node
*
* Implementation of theme_node_submitted()
*/
function triton_node_submitted($node) {
if ($node->type == 'article') {
$output = '';
if ($node->field_author[0]['view']) {
$str_author = t('By') . ' ';
foreach ($node->field_author as $author) {
$str_author .= $author['view'] . ', ';
}
$authors = trim($str_author, ', ');
}
if (($node->changed - $node->created) < 84400) {
$pub_time = t('Published:') . ' ';
$pub_time .= format_date($node->created, 'custom', 'F j, Y');
} else {
$pub_time = t('Updated:') . ' ';
$pub_time .= format_date($node->changed, 'custom', 'F j, Y');
}
$output .= '<div class="byline"><h6>' . $authors . '</h6></div>';
$output .= '<div class="dateline"><h6>' . $pub_time . '</h6></div>';
return $output;
} else {
return t('Submitted by !username on @datetime',
array(
'!username' => theme('username', $node),
'@datetime' => format_date($node->created),
));
}
}
Comments
CCK date (maybe)
Depending on whether you want the artcle date to be true reflection of the sysytem date (either updated or created) you could abandon the built in dates entirely and setup a CCK date field. This wouuld allow specific arbitrary control of the date by the author.
Yeah you should be setting a
Yeah you should be setting a date for each important event, rather than relying on drupal, because you might make a typo fix where you don't want to record the date..
So record "original date" "published date" and "update dates" (multiple value) perhaps.
You could maybe also use revision dates, as you could fix a typo without making a new revision.. However then you're relying on your reporters to get several things aligned and correct each time, which won't happen.
Now I have a published field
Now I have a published field and an updated field. How do I sort the view of articles chronologically? Should I just have a published date field and a checkbox that asks if the article is being updated?
That's a good idea. I already
That's a good idea. I already have a meta data field group. I could just add the date fields and use the byline function to test to see if they are set.