View Full Version : How to make $upcomingevents as a global variable?
evannn
06-09-2009, 09:37 AM
Hi everyone
I noticed that $upcomingevents is only applicable to forumhome template. Is it possible to make this $upcomingevents available across all templates?
Thanks
--------------- Added 1244545128 at 1244545128 ---------------
I have tried to make it global and hooked it at initstart up. Nope. Doesnt seem to be working. Sheesh.
$upcomingevents <-- I just want it to be available @ all templates/pages!
Dismounted
06-09-2009, 12:07 PM
IIRC, that data is stored in the datastore, under "eventcache" (or similar).
evannn
06-18-2009, 03:56 AM
Hi Dismounted, thanks for the reply.
This is the one: $vbulletin->eventcache
Do I have to write a plugin to retrieve the value? I have tried to insert it into the templates but it returned me "Array". Normal php functions can't work in templating.
Please advise.
Many thanks
Dismounted
06-18-2009, 05:34 AM
You need to fetch it from the datastore - inject it into $datastore_fetch[] (if it doesn't already exist in $specialtemplates).
evannn
06-19-2009, 08:32 AM
Hi Dismounted,
care to elaborate please?
Many thanks
Dismounted
06-19-2009, 08:42 AM
Look in global.php - find $datastore_fetch. Look at what it does.
evannn
06-24-2009, 06:35 AM
Hi guys,
No issues. Managed to retrieve data from eventcache. Thanks! But I wish to have the description of the event too.
I have modified "functions_calender.php", function build_events()
Modified the sql statement to
$events = $vbulletin->db->query_read_slave("
SELECT eventid, event.event, userid, event.title, recurring, recuroption, dateline_from, dateline_to, event.calendarid, IF (dateline_to = 0, 1, 0) AS singleday, customfields,
dateline_from AS dateline_from_user, dateline_to AS dateline_to_user, utc, dst
FROM " . TABLE_PREFIX . "event AS event
INNER JOIN " . TABLE_PREFIX . "calendar AS calendar USING (calendarid)
WHERE ((dateline_to >= $beginday AND dateline_from < $endday) OR (dateline_to = 0 AND dateline_from >= $beginday AND dateline_from <= $endday ))
AND visible = 1
AND calendar.options & " . intval($_CALENDAROPTIONS['showupcoming']) . "
ORDER BY dateline_from
");
while ($event = $vbulletin->db->fetch_array($events))
{
$event['title'] = htmlspecialchars_uni($event['title']);
$event['event'] = htmlspecialchars_uni($event['event']);
}
The additional of event columns "event" (which holds the description of the event)
But the event column doesn't reflect in eventcache.
What have I missed out or I'm heading in the wrong directions? Thanks
evannn
06-26-2009, 09:42 AM
anyone? :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.