{{CURRENTMONTHNAME}} minus one

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

{{CURRENTMONTHNAME}} minus one

Bierens,Gerard G.J.M.
Just like {{CURRENTMONTHNAME}} would give 'March', is it possible to
automatically get the previous month?

 

 

 

Thanks,

Gerard

 



----------------------------------------------------------------
Op deze e-mail zijn de volgende voorwaarden van toepassing:

http://www.fontys.nl/disclaimer

The above disclaimer applies to this e-mail message.
----------------------------------------------------------------
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: {{CURRENTMONTHNAME}} minus one

Joshua Yeidel
Try:

$lastmonthname = date("F", mktime(0, 0, 0, date("m")-1, date("d"),
date("Y")));

It may depend on your version of PHP;  there have been changes to date/time
functions, some of which are documented at:

http://us2.php.net/manual/en/function.date.php

-- Joshua





On 3/10/06 3:37 AM, "Bierens,Gerard G.J.M." <[hidden email]> wrote:

> Just like {{CURRENTMONTHNAME}} would give 'March', is it possible to
> automatically get the previous month?
>
>  
>
>  
>
>  
>
> Thanks,
>
> Gerard
>
>  
>
>
>
> ----------------------------------------------------------------
> Op deze e-mail zijn de volgende voorwaarden van toepassing:
>
> http://www.fontys.nl/disclaimer
>
> The above disclaimer applies to this e-mail message.
> ----------------------------------------------------------------
> _______________________________________________
> MediaWiki-l mailing list
> [hidden email]
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l

_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: {{CURRENTMONTHNAME}} minus one

Bierens,Gerard G.J.M.
In reply to this post by Bierens,Gerard G.J.M.
Hello Joshua,
That makes sense to me, but where do I add this code?
 
-- Gerard
 
Joshua Yeidel yeidel at wsu.edu
<mailto:mediawiki-l%40Wikimedia.org?Subject=%5BMediawiki-l%5D%20%7B%7BCU
RRENTMONTHNAME%7D%7D%20minus%20one&In-Reply-To=399E1B1730511340ACC9D56B8
48CFF652443D4%40KOOTENAY.medewerker.fontys.local>

Sat Mar 11 02:23:17 UTC 2006
 
Try:
 
$lastmonthname = date("F", mktime(0, 0, 0, date("m")-1, date("d"),
date("Y")));
 
It may depend on your version of PHP;  there have been changes to
date/time
functions, some of which are documented at:
 
http://us2.php.net/manual/en/function.date.php
<http://us2.php.net/manual/en/function.date.php>
 
-- Joshua
 
 
 
 
 
On 3/10/06 3:37 AM, "Bierens,Gerard G.J.M." <G.Bierens at fontys.nl
<http://mail.wikipedia.org/mailman/listinfo/mediawiki-l> > wrote:
 

> Just like {{CURRENTMONTHNAME}} would give 'March', is it possible to
> automatically get the previous month?
>
>  
>
>  
>
>  
>
> Thanks,
>
> Gerard
>

 



----------------------------------------------------------------
Op deze e-mail zijn de volgende voorwaarden van toepassing:

http://www.fontys.nl/disclaimer

The above disclaimer applies to this e-mail message.
----------------------------------------------------------------
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: {{CURRENTMONTHNAME}} minus one

Joshua Yeidel
I just found a way to compute the correct string in PHP.  I don't know how
to make it available as a "magic word".  I looked at the "meta" site and the
code, but I didn't find an easy solution.

It is possible that a solution could come from the world of templates -- I'm
not an expert, but it seems doable.  For example, you could have an array
that is indexed by {{CURRENTMONTH}} which gives the previous month's name.

En.wikipedia.org has a DAYSUNTILSUNDAY template that might prove
instructive.  It does a lookup into an array that returns a string based on
the day of the week.  Yours would return a string based on the month number.
You will also need to have (or add) Template:array from wikipedia to your
wiki.

That's about all I can do on this now.  Perhaps someone else can add.

-- Joshua



On 3/15/06 2:38 AM, "Bierens,Gerard G.J.M." <[hidden email]> wrote:

> Hello Joshua,
> That makes sense to me, but where do I add this code?
>  
> -- Gerard
>  
> Joshua Yeidel yeidel at wsu.edu
> <mailto:mediawiki-l%40Wikimedia.org?Subject=%5BMediawiki-l%5D%20%7B%7BCU
> RRENTMONTHNAME%7D%7D%20minus%20one&In-Reply-To=399E1B1730511340ACC9D56B8
> 48CFF652443D4%40KOOTENAY.medewerker.fontys.local>
>
> Sat Mar 11 02:23:17 UTC 2006
>  
> Try:
>  
> $lastmonthname = date("F", mktime(0, 0, 0, date("m")-1, date("d"),
> date("Y")));
>  
> It may depend on your version of PHP;  there have been changes to
> date/time
> functions, some of which are documented at:
>  
> http://us2.php.net/manual/en/function.date.php
> <http://us2.php.net/manual/en/function.date.php>
>  
> -- Joshua
>  
>  
>  
>  
>  
> On 3/10/06 3:37 AM, "Bierens,Gerard G.J.M." <G.Bierens at fontys.nl
> <http://mail.wikipedia.org/mailman/listinfo/mediawiki-l> > wrote:
>  
>> Just like {{CURRENTMONTHNAME}} would give 'March', is it possible to
>> automatically get the previous month?
>>
>>  
>>
>>  
>>
>>  
>>
>> Thanks,
>>
>> Gerard
>>
>
>  
>
>
>
> ----------------------------------------------------------------
> Op deze e-mail zijn de volgende voorwaarden van toepassing:
>
> http://www.fontys.nl/disclaimer
>
> The above disclaimer applies to this e-mail message.
> ----------------------------------------------------------------
> _______________________________________________
> MediaWiki-l mailing list
> [hidden email]
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l

_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: {{CURRENTMONTHNAME}} minus one

Rick DeNatale
On 3/15/06, Joshua Yeidel <[hidden email]> wrote:
> I just found a way to compute the correct string in PHP.  I don't know how
> to make it available as a "magic word".  I looked at the "meta" site and the
> code, but I didn't find an easy solution.
>
> It is possible that a solution could come from the world of templates -- I'm
> not an expert, but it seems doable.  For example, you could have an array
> that is indexed by {{CURRENTMONTH}} which gives the previous month's name.

I do something similar on my wiki to provide an on-this-date feature
on the home page.  I've got a family of history templates with a
master which has 366 template subpages for each day of the year.

Adapting what I do to get a last month template would look something like this:

1st make a template called say LastMonth
Template:LastMonth
{{LastMonth/{{CURRENTMONTHNAME}}}}

Then make 12 templates

Template:LastMonth/January
December

Template:LastMonth/February
January

...

Template:LastMonth/December
November

voila!


--
Rick DeNatale

Visit the Project Mercury Wiki Site
http://www.mercuryspacecraft.com/
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: {{CURRENTMONTHNAME}} minus one

Joshua Yeidel
This is a nice straightforward solution, especially since the range is
limited to 12.  That "array" template stuff I mentioned earlier in the
thread can be mind-boggling.

jj


On 3/15/06 2:27 PM, "Rick DeNatale" <[hidden email]> wrote:

> On 3/15/06, Joshua Yeidel <[hidden email]> wrote:
>> I just found a way to compute the correct string in PHP.  I don't know how
>> to make it available as a "magic word".  I looked at the "meta" site and the
>> code, but I didn't find an easy solution.
>>
>> It is possible that a solution could come from the world of templates -- I'm
>> not an expert, but it seems doable.  For example, you could have an array
>> that is indexed by {{CURRENTMONTH}} which gives the previous month's name.
>
> I do something similar on my wiki to provide an on-this-date feature
> on the home page.  I've got a family of history templates with a
> master which has 366 template subpages for each day of the year.
>
> Adapting what I do to get a last month template would look something like
> this:
>
> 1st make a template called say LastMonth
> Template:LastMonth
> {{LastMonth/{{CURRENTMONTHNAME}}}}
>
> Then make 12 templates
>
> Template:LastMonth/January
> December
>
> Template:LastMonth/February
> January
>
> ...
>
> Template:LastMonth/December
> November
>
> voila!
>
>
> --
> Rick DeNatale
>
> Visit the Project Mercury Wiki Site
> http://www.mercuryspacecraft.com/
> _______________________________________________
> MediaWiki-l mailing list
> [hidden email]
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l

_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: {{CURRENTMONTHNAME}} minus one

Christof Damian
In reply to this post by Rick DeNatale
You could also use my calendar extension:
http://meta.wikimedia.org/wiki/User:Cdamian/calendar

It allows to include pages based on dates. For example:

== Last Month ==
<calendar>
view=today
date="-1 month"
format="Calendar/%n.%Y"
</calendar>

== On this day ==
<calendar>
view=today
date="-1 month"
format="Calendar/%j.%n"
</calendar>

It doesn't fit for every case, but have a look at the examples to see
what is possible.

christof


On Wed, 15 Mar 2006, Rick DeNatale wrote:

> On 3/15/06, Joshua Yeidel <[hidden email]> wrote:
> > I just found a way to compute the correct string in PHP.  I don't know how
> > to make it available as a "magic word".  I looked at the "meta" site and the
> > code, but I didn't find an easy solution.
> >
> > It is possible that a solution could come from the world of templates -- I'm
> > not an expert, but it seems doable.  For example, you could have an array
> > that is indexed by {{CURRENTMONTH}} which gives the previous month's name.
>
> I do something similar on my wiki to provide an on-this-date feature
> on the home page.  I've got a family of history templates with a
> master which has 366 template subpages for each day of the year.
>
> Adapting what I do to get a last month template would look something like this:
>
> 1st make a template called say LastMonth
> Template:LastMonth
> {{LastMonth/{{CURRENTMONTHNAME}}}}
>
> Then make 12 templates
>
> Template:LastMonth/January
> December
>
> Template:LastMonth/February
> January
>
> ...
>
> Template:LastMonth/December
> November
>
> voila!
>
>

--
Christof Damian        
[hidden email]
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: {{CURRENTMONTHNAME}} minus one

Hans Voss
You mean this is 'build in' into the calendar template?
And here I was, hacking up your code to generate something similar
(display "next week").
Darn.

On 3/16/06, Christof Damian <[hidden email]> wrote:

> You could also use my calendar extension:
> http://meta.wikimedia.org/wiki/User:Cdamian/calendar
>
> It allows to include pages based on dates. For example:
>
> == Last Month ==
> <calendar>
> view=today
> date="-1 month"
> format="Calendar/%n.%Y"
> </calendar>
>
> == On this day ==
> <calendar>
> view=today
> date="-1 month"
> format="Calendar/%j.%n"
> </calendar>
>
> It doesn't fit for every case, but have a look at the examples to see
> what is possible.
>
> christof
>
>
> On Wed, 15 Mar 2006, Rick DeNatale wrote:
> > On 3/15/06, Joshua Yeidel <[hidden email]> wrote:
> > > I just found a way to compute the correct string in PHP.  I don't know how
> > > to make it available as a "magic word".  I looked at the "meta" site and the
> > > code, but I didn't find an easy solution.
> > >
> > > It is possible that a solution could come from the world of templates -- I'm
> > > not an expert, but it seems doable.  For example, you could have an array
> > > that is indexed by {{CURRENTMONTH}} which gives the previous month's name.
> >
> > I do something similar on my wiki to provide an on-this-date feature
> > on the home page.  I've got a family of history templates with a
> > master which has 366 template subpages for each day of the year.
> >
> > Adapting what I do to get a last month template would look something like this:
> >
> > 1st make a template called say LastMonth
> > Template:LastMonth
> > {{LastMonth/{{CURRENTMONTHNAME}}}}
> >
> > Then make 12 templates
> >
> > Template:LastMonth/January
> > December
> >
> > Template:LastMonth/February
> > January
> >
> > ...
> >
> > Template:LastMonth/December
> > November
> >
> > voila!
> >
> >
>
> --
> Christof Damian
> [hidden email]
> _______________________________________________
> MediaWiki-l mailing list
> [hidden email]
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>


--
----
Met vriendelijke groeten / With kind regards
Hans Voss
---------------------------------------
skype: hans.voss
google talk enabled
I am looking for people to invite to Gmail. I have 100 invitations left.
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: {{CURRENTMONTHNAME}} minus one

Christof Damian
On Thu, 16 Mar 2006, Hans Voss wrote:
> You mean this is 'build in' into the calendar template?  And here I
> was, hacking up your code to generate something similar (display
> "next week").  Darn.

Well, I am just using the strtotime function for the calendar
extension. So you can just use:

<calendar>
view=week
date="next week"
format="Sandbox/%j.%n.%Y"
</calendar>

or similar. Thats in the code since the 15.9.2005 version :-)

christof
--
Christof Damian        
[hidden email]
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: {{CURRENTMONTHNAME}} minus one

Hans Voss
Just goes to show that I never programmed PHP before that little hack
I made in your extenstion.

We live and learn :-)
Thanks.

On 3/16/06, Christof Damian <[hidden email]> wrote:

> On Thu, 16 Mar 2006, Hans Voss wrote:
> > You mean this is 'build in' into the calendar template?  And here I
> > was, hacking up your code to generate something similar (display
> > "next week").  Darn.
>
> Well, I am just using the strtotime function for the calendar
> extension. So you can just use:
>
> <calendar>
> view=week
> date="next week"
> format="Sandbox/%j.%n.%Y"
> </calendar>
>
> or similar. Thats in the code since the 15.9.2005 version :-)
>
> christof
> --
> Christof Damian
> [hidden email]
> _______________________________________________
> MediaWiki-l mailing list
> [hidden email]
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>


--
----
Met vriendelijke groeten / With kind regards
Hans Voss
---------------------------------------
skype: hans.voss
google talk enabled
I am looking for people to invite to Gmail. I have 100 invitations left.
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l