PDA

View Full Version : How to link to current date for the calendar


SgtSling
01-08-2012, 05:25 PM
I want to create a static image displayed on my cms that is linked to the current date for the vbcalendar. Is there a current date command so that I don't have to change the link on the picture everyday?

Is this possible?

Lynne
01-08-2012, 05:37 PM
You can probably use the calendar_getday_start hook and do something like:

if (!$vbulletin->GPC['day']), then set $vbulletin->GPC['day'] to todays date

SgtSling
01-08-2012, 06:25 PM
You can probably use the calendar_getday_start hook and do something like:

if (!$vbulletin->GPC['day']), then set $vbulletin->GPC['day'] to todays date

Can you be more specific?
What do I use as the href on the image?
Thanks!

Lynne
01-08-2012, 07:13 PM
calendar.php?do=getinfo&c=xx

xx would be the calendar id. That link is not going to work right now because the date isn't specified which is why I'm saying to specify today's date in the plugin and then it will work.

SgtSling
01-08-2012, 08:14 PM
I disabled it because it was giving errors.
Here is the link I used.
http://www.rotharmy.com/forums/calendar.php?do=getinfo&c=1
The calendar is 1 (the public calendar)

Here is the error,

Parse error: syntax error, unexpected ',' in /home/content/r/o/t/rotharmy/html/forums/calendar.php(1160) : eval()'d code on line 1

here is how I entered it into the hook manager.

SgtSling
01-08-2012, 08:15 PM
thanks for helping with this Lynne!

kh99
01-08-2012, 08:26 PM
Lynne wasn't posting the exact code, just a description of what needed to be done. But try this:

if (!$vbulletin->GPC['day'])
$vbulletin->GPC['day'] = vbdate('Y-m-d');

SgtSling
01-08-2012, 08:41 PM
That works! So it should point to tormorrows date after midnight (server time)?

Thanks!

kh99
01-08-2012, 08:48 PM
That should go by each user's local time. If you want to always go by the server time, change vbdate to just 'date' (without the quotes).