When I use the extension and calculate the $diff, the values of the $diff is being displayed as your days or hours. The if statements would then seem to be wrong.
Many thanks SirNot, I get the basic usage of it, but have no idea how to convert it to Unix code so I can do my calculations.
What do you mean btw jimw? I've checked my if statements and can't see anything wrong with them (or at least I don't think so, never done php/if statements before this you see)
In each IF statement, you are doing a calculation on $diff. In the first IF, you are checking for month. You calculate the $diff to be number of months, yet in the IF that does the display, you are still using the value of 2592000. You should use 2 instead. That is, it should read if ($diff < 2). It should also be that way in your second IF and in th else. Then in the else just make it:
else if {$diff >0)
That seems to work for me.
jimw.
I love you <3
Thank you so much chap, really appreciate it. I've still got the stray date at the bottom though which I'm not quite sure why it's showing up!
else if ($diff > 0 and $diff < 86400 )
Is the code for hours, and it certainly doesn't fall into that short a timescale!
# All I Need, Marks Set Go! and Dispatch
1 month left, at Le Pub, Newport
# All I Need, Marks Set Go! and Dispatch
1 hour left, at Le Pub, Newport
Duplicates it, and has a different time difference :(
You should just replace: $Context->Dictionary['EnableCalendar'] = 'Enable the gig calendar?'; by:$Context->SetDefinition('EnableCalendar', 'Enable the gig calendar?');
and: $diff = $diff + 3600; // Ammendment made due to server being one hour out of synch by$Context->Configuration['GigCalendarSynch'] = 3600;
...
$diff = $diff + ForceInt($Context->Configuration['GigCalendarSynch'], 0); // Ammendment made due to server being one hour out of synch
Sorry for being dumb, but what exactly would that do? Surely the gig calendar option in the control panel is completely seperate to the date ammendment thing?
$Context->SetDefinition allow your extension to be translated.
For the other one, I don't know why you need to synch the time, I just supposed it depends of your server and it should be a setting you can easely change
Comments
You should just replace:
$Context->Dictionary['EnableCalendar'] = 'Enable the gig calendar?';
by:
$Context->SetDefinition('EnableCalendar', 'Enable the gig calendar?');
and:
$diff = $diff + 3600; // Ammendment made due to server being one hour out of synch
by
$Context->Configuration['GigCalendarSynch'] = 3600; ... $diff = $diff + ForceInt($Context->Configuration['GigCalendarSynch'], 0); // Ammendment made due to server being one hour out of synch
Again, sorry for being dumb.
For the other one, I don't know why you need to synch the time, I just supposed it depends of your server and it should be a setting you can easely change
I had to shift the time becuase of the server, it was an hour out, so if the event was in 8 hours time, it was showing up as being 7 hours ;o