Page 1 of 3

Date difference counter plugin

Posted: Wed Aug 30, 2006 7:21 pm
by deurk
Fellow serendipiters...

Here is a plug-in that can display a difference between the current date and a specified date (either in the past or in the future). It is straightforward to use and is ready for multilingual blogs.

Here is the syntax to use inside 'title' and 'displayed text' fields:

Code: Select all

<en>text in English</en>
<fr>texte en Francais</fr>
<de>Ich spräche nicht Deutch!</de>
You can also use some variables (without which the plug-in would be pointless):

Code: Select all

%Y: years difference
%M: months difference
%D: days difference
%h: hours difference
%m: minutes difference
%s: seconds difference
Current Features of version 0.24:
(bold items have been updated in the last revision)
  • It can count both ways (past or future) compared to present time.
  • It is stackable.
  • It provides an usage example by default.
  • The text displayed is completely customizable
  • It supports any language you currently have via an easy syntax.
  • It supports the non-use of the mentionned syntax for basic plugin configuration.
  • The syntax now supports singular/plural terms like shown in the default text exemple
Features missing so far:
  • It lacks no display of values like 0 units
Want to see it in action?
Visit Gaïa's blog

Want to try it?
Download version 0.24 here

Comments, ideas and code changes are more than welcomed :D

Re: Age plugin

Posted: Wed Aug 30, 2006 7:25 pm
by garvinhicking
Hi!

Even though I personally don't need that plugin, it's great to see that you have succeeded in creating one! Good work!

Also your blog looks very nice. Which was the reason I thought to reply here :) Very pretty pictures of your baby. :-)

I hope you'll have fun with Serendipity,
Garvin

Posted: Wed Aug 30, 2006 7:32 pm
by mgroeninger
I'm with Garvin... I don't really have need for the plugin (though I have thought about something similar before, I have never really found a good use for it).

BUT, your blog is great and your daughter is adorable! (Your pictures are terrific, too!)

Posted: Wed Aug 30, 2006 7:45 pm
by carl_galloway
deurk, well done. I actually can think of several uses for your plugin, unfortunately not for my own site, but let me tell you anyway. Perhaps other users might agree with me.

School teachers could use this plugin to create a project blog for their students, perhaps where a science project is aged instead of a person.

Also, scientists, bioligists, physicists, laboratory trials etc might find it useful. Add pharmaceutical companies and hospitals who might want to show the age of a drug trial.

Political strategists or fund-raising charities might want to show the age of a campaign contribution program, and perhaps they could have the plugin modifed to show the dollars received.

If this plugin could also be amended to show a countdown from a defined point, then this might become even more useful to Serendipity users, I'm not sure if we have a countdown plugin and if we do then maybe they should be merged.

Carl

Posted: Wed Aug 30, 2006 8:03 pm
by carl_galloway
Actually I've thought of a reason why I want it for my own site, simply to show the age of my blog, duh, all that longwinded stuff above and then kapow it hits me, I want that plugin

Posted: Wed Aug 30, 2006 8:34 pm
by Harald Weingaertner
So finally someone should be interested ;) I am :)

I will find an area in one of my blogs. Where can i get this plugin?

Regards, Harald

Posted: Wed Aug 30, 2006 9:30 pm
by d_cee
Hi deurk

What a great plugin idea it would go well in my 'Being a Dad' blog. Are you going to make it available to download.

And I agree with all the previous posts - you have a beautiful daughter

Dave

Posted: Thu Aug 31, 2006 9:55 am
by Dalif
Yeah.. That would be kind of fun to have around.

Like your site (looks a spitting image of my own..). I like the english/french feature. Well nifty.

Keep it up!

Posted: Tue Sep 05, 2006 5:55 pm
by deurk
Wow :)

Thanks for the cheers: Gaïa will be delighted to know she has such a fan club :P

And about that plugin, let me allow it to be used as a counter too and I will release it :)

Posted: Tue Sep 05, 2006 7:03 pm
by carl_galloway
yeah, then I can use it to age my blog and count the number of templates released!!! looking forward to your plugin

Posted: Wed Sep 06, 2006 6:13 pm
by deurk
Ok, I have included the possibility to go inwards or backwards in time to your liking. Now I am trying to get it to be text customizeable (and in several languages).

Not so sure about that yet.
Might release it first in one language :P

Posted: Thu Sep 07, 2006 5:41 pm
by deurk
All right.

Here is a first version (named 0.2 since I added multilanguage option to it) of the date counter plugin.

DONE:
- It can count both ways (past or future) compared to present time.
- It is stackable.
- It provides an usage example by default.
- It supports any language you currently have with a stupidly easy syntax:

Code: Select all

<en>text in english</en>
<fr>texte en francais</fr>
<de>je ne parle pas allemand!</de>
...
- Title support the same syntax since I hate having little details like a title not translated (boohoo for the blog title though :P).

TO DO:
- It lacks plurial handling
- It lacks no display of values like 0 units
Those will be coded soon.

Please test it and tell me what you think of it, what can be improved, etc... and PLEASE REMEMBER that I am NO PROGRAMMER, I do network stuff for a living so my code my be as dirty as a sewer rat (no idea why this idea popped into my brain).

Thanks :D

Posted: Thu Sep 07, 2006 7:42 pm
by deurk
Updated it to 0.21 to add some exemples default values and correct a few little thingies.

Posted: Thu Sep 07, 2006 8:44 pm
by judebert
I'll be looking at this later this evening!

Meanwhile, you may want to consider switching to the Serendipity internationalization standard: create a variable for each text string you may want to substitute in different languages. Then define each variable with its English text string in a file called lang_en.inc.php. Do the same for German in lang_de.inc.php, for French in lang_fr.inc.php, etc.

Your example might be named PLUGIN_DATECOUNTER_TEXT, and then in lang_en.inc.php you'd put @define('PLUGIN_DATECOUNTER_TEXT', 'Text in English');, while in lang_fr.inc.php you'd put @define('PLUGIN_DATECOUNTER_TEXT', 'Texte en Francais');.

Posted: Thu Sep 07, 2006 9:40 pm
by deurk
Already done but CONTENT of the plugin should be editable without touching the files... So that's my proposal to it. Try it and tell me ;)