Gossamer Forum
Quote Reply
Weekdays Plugin help
Hi,

I'm hoping someone can help me out with this since I never written a plugin before.

The first part is a global
I would need a global named weekdays
it would be like <%weekdays%>
and it would change each day displaying what ever that day is, I'm guessing this is simple.


Heres the plugin part

I need a plugin when called for each day I can have a different message displyed something like this
<%if weekdays eq 'Monday'%>
<%include monday.html%>
<%elsif weekdays eq 'Tuesday'%>
<%include tuesday.html%>
<%endif%>

also in that include html I want to be able to place a global

If all this could be done in one shot that would be cool

Thanks
Quote Reply
Re: [incik] Weekdays Plugin help In reply to
Hi.

To begin with, let me say that me just playing with test install of Gossamer Forum and trying to get hold of things. Onto your query:

Global week_days

sub {
require GT::Date;
my $date = GT::Date::date_get();
return GT::Date::date_get($date, '%dddd%');
}

Call it in any template <%week_days%>

Second Part: Not sure what a Plugin Means And What Exactly It Does. Anyway, if it's a message that you would want to change as per the <%week_days%>, then try following:

create a template mymessage.html whatever ...

In the template just as you mentioned in your requirements:

<%if week_days eq 'Monday'%>
Message For Monday
<%elsif week_days eq 'Tuesday'%>
Message For Tuesday
.......
.......
.......

Save This keeping in mind the <%if ...> <%endif%> pair.
Then include this where-ever you would want the Message displayed.

<%include mymessage.html%>

That should be it....

HyTC
Quote Reply
Re: [HyperTherm] Weekdays Plugin help In reply to
Works Great

Thanks
Quote Reply
Re: [incik] Weekdays Plugin help In reply to
Sorry but this plugin isnt working

its stuck on wednesday and doesnt change to any other day

can someone write it another way or something

Thanks
Quote Reply
Re: [incik] Weekdays Plugin help In reply to
Try this:

sub {
require GT::Date;
my $date = GT::Date::date_get();
my $format = GT::Date::date_set_format("%dddd%");
return GT::Date::date_get();
}

HyTC
Quote Reply
Re: [HyperTherm] Weekdays Plugin help In reply to
A warning - if you are using mod_perl and use date_set_format to change the date format, it will remain changed and you'll start having problems with dates all over the place.

You can just use this in your template instead of using a global:

<%set Day = GT::Date::date_get()%>
<%set Day = GT::Date::date_transform($Day,'%yyyy%-%mm%-%dd%','%dddd%')%>