modifying serendipity_event_entrylastmodified

Creating and modifying plugins.
Post Reply
search1
Regular
Posts: 105
Joined: Thu Sep 24, 2009 10:42 pm

modifying serendipity_event_entrylastmodified

Post by search1 »

Hi,

I need the plugin serendipity_event_entrylastmodified for my CMS, that I use with s9y.
But the style is not good. I want the output like "Zuletzt bearbeitet am 17.09.2010 23:59" in the same line and style as: "Verfasser: XY • 17.09.2010" under each entry. The name of the last modifier should also be shown.
I suppose, I have to change something in the plugins/serendipity_event_entrylastmodified/serendipity_event_entrylastmodified.php and in the templates/my template/entries.tpl in the line:

Code: Select all

        <p class="meta">Verfasser: {$entry.author} &bull; {$entry.timestamp|@formatTime:'%d.%m.%Y'}{if $entry.has_comments}{if $view != 'entry'} &bull; <a href="{$entry.link}#comments">{$entry.comments} {$entry.label_comments}</a>{/if}{/if}</p>
?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: modifying serendipity_event_entrylastmodified

Post by garvinhicking »

Hi!

Hm, that's harder to achieve. You need to place the $entry.add_footer variable near the "meta" class. But also other plugins add their output in that class, so you might need to do some adjusting there.

We could also modify the plugin to have its own smarty variable and might need some coding for that, though. I just modified the plugin to version 1.7 and added the smarty variable {$entry.last_modified} that you can put to your entry. The plugin STILL emits its outout also to $entry.add_footer, so you might need CSS to hide the second output, like ".footer .entry_last_modified { display: none}" to hide the second occurence.
The name of the last modifier should also be shown.
Serendipity and the plugin do not store that, only the creator of an entry is logged.

HTH,
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/
search1
Regular
Posts: 105
Joined: Thu Sep 24, 2009 10:42 pm

Re: modifying serendipity_event_entrylastmodified

Post by search1 »

Hi,

thank you very much for updating the plugin! It isn´t shown in SPARTACUS in my S9Y as a new version, but I copied the new file serendipity_event_entrylastmodified.php from sourceforge and put it in my test-version.
Now under every entry it was shown twice: "Zuletzt bearbeitet am ..."
Then I added the variable {$entry.last_modified} in templates/my template/entries.tpl:

Code: Select all

        <p class="meta">Verfasser: {$entry.author} &bull; {$entry.timestamp|@formatTime:'%d.%m.%Y'}  &bull;  {$entry.last_modified}{if $entry.has_comments}{if $view != 'entry'} &bull; <a href="{$entry.link}#comments">{$entry.comments} {$entry.label_comments}</a>{/if}{/if}</p>
This produced the following output:
footer.jpg
footer.jpg (20.8 KiB) Viewed 5016 times
The style is not correct of the first "last modified". I suppose, it should be <p class="meta">, but is <div class="entry_last_modified" ? Also a strange number is shown.

And where can i add the css-code:

Code: Select all

.footer .entry_last_modified { display: none}
?
In serendipity_event_entrylastmodified.php, entries.tpl of my template or a ?.css of my template?

Thanks for your great work!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: modifying serendipity_event_entrylastmodified

Post by garvinhicking »

Hi!

There was a bug in the earlier revision, check out the plugin again.
And where can i add the css-code:

Code: Select all

.footer .entry_last_modified { display: none}
?
In serendipity_event_entrylastmodified.php, entries.tpl of my template or a ?.css of my template?
In your template's style.css sheet. You might need to replace ".footer" with the propper CSS class that encapsulates the double occurence of entry_last_modified that you want to remove.

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/
search1
Regular
Posts: 105
Joined: Thu Sep 24, 2009 10:42 pm

Re: modifying serendipity_event_entrylastmodified

Post by search1 »

Hi Garvin,

thanks for your great work!
I installed the new version of the plugin; same thing: I want a different style in the same line and style as: "Verfasser: XY • 17.09.2010" under each entry.
Then I put the new variable {$entry.last_modified} in the entries.tpl of my template and the last modifier appiers twice:
footer1.jpg
footer1.jpg (17.75 KiB) Viewed 4995 times
Then I wrote in the style.css of my template:

Code: Select all

.entry_last_modified { display: none}
and it appears:
footer2.jpg
footer2.jpg (8.57 KiB) Viewed 4995 times
(.footer .entry_last_modified { display: none} makes no difference to the first picture in this comment)

How can I change the strange number to the right output? And how can I change the style of the shown comments?
Thanks!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: modifying serendipity_event_entrylastmodified

Post by garvinhicking »

Hi!

I forgot that $entry.last_modified was there already, and the plugin unproperly appended it.

If you display it yourself, you actually can simply remove the entrylastmodified plugin and place {$entry.last_modified|@date_format:...} at the place you want it. You can look up the variables needed for formatting the timestamp on smarty.net/date_format.

(I also updated the plugin to 1.9 now and the string variable with the html markup is now $entry.string_last_modified} - if you place that, you still need to adjust your CSS to properly remove the output inside the footer without removing your manual output. Your current CSS would remove ALL instances of a last modifier output string)

HTH,
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/
search1
Regular
Posts: 105
Joined: Thu Sep 24, 2009 10:42 pm

Re: modifying serendipity_event_entrylastmodified

Post by search1 »

Hi Garvin,

everything works fine, thank you:
I wrote the {$entry.last_modified|@date_format:...} in the entries.tpl of my template:

Code: Select all

<p class="meta">{$entry.author} &bull; {$entry.timestamp|@formatTime:'%d.%m.%Y %H:%M'} &bull; {$entry.last_modified|@date_format:'zuletzt ge&auml;ndert von einem Autor am %d.%m.%Y %H:%M'} {if $entry.has_comments}{if $view != 'entry'} &bull; <a href="{$entry.link}#comments">{$entry.comments} {$entry.label_comments}</a>{/if}{/if}</p>
and it worked:
footer3.jpg
footer3.jpg (28.75 KiB) Viewed 4986 times
But now, it woud be perfect to show the last modified time only, if there was a modifying (but the comments also, if there are some, also if there is no modifying of the entry.
Here my try, that didn´t work:

Code: Select all

<p class="meta">{$entry.author} &bull; {$entry.timestamp|@formatTime:'%d.%m.%Y %H:%M'} {{if $entry.timestamp|@formatTime != $entry.last_modified|@date_format}{ &bull; {$entry.last_modified|@date_format:'zuletzt ge&auml;ndert von einem Autor am %d.%m.%Y %H:%M'}} {if $entry.has_comments}{if $view != 'entry'} &bull; <a href="{$entry.link}#comments">{$entry.comments} {$entry.label_comments}</a>{/if}{/if}</p>
In the plugin is a $format_string_nomod; no idea, if this can help?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: modifying serendipity_event_entrylastmodified

Post by garvinhicking »

Hi!

You could do a comparison if {$entry.last_modifed != $entry.timestamp} so that you only show the code if those differ.

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/
search1
Regular
Posts: 105
Joined: Thu Sep 24, 2009 10:42 pm

Re: modifying serendipity_event_entrylastmodified

Post by search1 »

Thanks for the answer.
Something dosn´t work yet:
The modifying is always shown, also if there is no modifying:

Code: Select all

<p class="meta">{$entry.author} &bull; {$entry.timestamp|@formatTime:'%d.%m.%Y %H:%M'} {if $entry.last_modifed != $entry.timestamp} &bull; {$entry.last_modified|@date_format:'zuletzt ge&auml;ndert von einem Autor am %d.%m.%Y %H:%M'}{/if} {if $entry.has_comments}{if $view != 'entry'} &bull; <a href="{$entry.link}#comments">{$entry.comments} {$entry.label_comments}</a>{/if}{/if}</p>
What is wrong?
Thank you very much!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: modifying serendipity_event_entrylastmodified

Post by garvinhicking »

Hi!

Your spelling: "last_modifed" :)

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/
search1
Regular
Posts: 105
Joined: Thu Sep 24, 2009 10:42 pm

Re: modifying serendipity_event_entrylastmodified

Post by search1 »

Thank you! Everything works perfekt! Great help.
Post Reply