Hi guys!
I need to show the date each entry was last edited on the frontpage and on each entrys page.
Is there an option, a tag or a plugin that makes this possible?
Thanks
obakemono
last edited date
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: last edited date
There are two ways to get this to work.
The first and easiest way is to use our great Smarty templating for this.
Just create a directory 'templates/obakemono'. Copy the files 'entries.tpl' and 'info.txt' of the 'templates/default/' folder into that new folder. Edit the 'info.txt' and insert your own custom name for the template. Then edit the 'entries.tpl' file and near the place where {$entry.timestamp} is put, you can just add {$entry.last_modified} in a similar fashion. You can place it with any surrounding HTML code there easily. This is the most flexible solution.
An easier way is to use this plugin:
Save that as 'plugins/serendipity_event_entrylastmodified/serendipity_event_entrylastmodified.php' and install it via Admin Interface > Configure Plugins in the Event plugin section. As soon as you installed it, you will see the "Last modified" date inserted in your entries. But you are not as flexible in positioning it than with the first solution.
Regards,
Garvin
The first and easiest way is to use our great Smarty templating for this.
Just create a directory 'templates/obakemono'. Copy the files 'entries.tpl' and 'info.txt' of the 'templates/default/' folder into that new folder. Edit the 'info.txt' and insert your own custom name for the template. Then edit the 'entries.tpl' file and near the place where {$entry.timestamp} is put, you can just add {$entry.last_modified} in a similar fashion. You can place it with any surrounding HTML code there easily. This is the most flexible solution.
An easier way is to use this plugin:
Code: Select all
<?php # $Id: serendipity_event_bbcode.php,v 1.19 2005/03/10 14:02:06 garvinhicking Exp $
@define('PLUGIN_EVENT_ENTRYLASTMODIFIED_NAME', 'Show last modification date');
@define('PLUGIN_EVENT_ENTRYLASTMODIFIED_DESC', 'Shows the last modification date of an entry on the blogs frontpage');
@define('PLUGIN_EVENT_ENTRYLASTMODIFIED_HTML', '<br /><div style="text-align: right">Last modified on %s</div>');
class serendipity_event_entrylastmodified extends serendipity_event {
var $title = PLUGIN_EVENT_ENTRYLASTMODIFIED_NAME;
function introspect(&$propbag) {
global $serendipity;
$propbag->add('name', PLUGIN_EVENT_ENTRYLASTMODIFIED_NAME);
$propbag->add('description', PLUGIN_EVENT_ENTRYLASTMODIFIED_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking');
$propbag->add('version', '1.0');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
'php' => '4.1.0'
));
$propbag->add('event_hooks', array('entry_display' => true));
}
function generate_content(&$title) {
$title = $this->title;
}
function event_hook($event, &$bag, &$eventData, $addData = null) {
global $serendipity;
$hooks = &$bag->get('event_hooks');
if (isset($hooks[$event])) {
switch($event) {
case 'entry_display':
$extended_key = &$this->getFieldReference('extended', $eventData);
if ($addData['extended'] || $addData['preview']) {
$eventData[0]['exflag'] = 1;
$extended_key .= sprintf(PLUGIN_EVENT_ENTRYLASTMODIFIED_HTML, serendipity_formatTime(DATE_FORMAT_SHORT, $eventData[0]['last_modified']));
} else {
$elements = count($eventData);
for ($i = 0; $i < $elements; $i++) {
if (!isset($eventData[$i]['add_footer'])) {
$eventData[$i]['add_footer'] = '';
}
$eventData[$i]['add_footer'] .= sprintf(PLUGIN_EVENT_ENTRYLASTMODIFIED_HTML, serendipity_formatTime(DATE_FORMAT_SHORT, $eventData[$i]['last_modified']));
}
}
return true;
break;
}
}
return false;
}
}
/* vim: set sts=4 ts=4 expandtab : */
?>
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: thx
Yes, that's right - you need to use version 0.8
Upgrading is easy, and the final release will be out next week; you can use beta4, it's quite stable.
Regards,
Garvin
Upgrading is easy, and the final release will be out next week; you can use beta4, it's quite stable.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/