View Full Version : Can it really be that difficult ?
DarrinM
01-28-2005, 02:21 PM
I would like to display customfields information within the calendar month view, I have managed to edit the template to show all the fields but of course it also shows the : ; { etc
However I wish to only show 2 or 3 of the fields and not all - can this be done and if so how ?!?!
Many Thanks
Darrin
Marco van Herwaarden
01-28-2005, 08:16 PM
you are trying to show a serialized array.
In your php script, first do:
$mynewarray = unserialize($serializedarray);
Then use $mynewarray['field'] in your template.
DarrinM
01-28-2005, 09:27 PM
Hi Marco, thanks for replying
I have looked through calendar.php and notice that these lines exist
$eventfields = unserialize($eventinfo['customfields']);
and
$eventcustomfields = unserialize($eventinfo['customfields']);
Would I be right to think I therefore dont need to add the line to calendar.php and then only edit the template, if not please advise, if you could be more specific to say for example display the third item in the serialization it would be most helpful
Regards
Darrin
Marco van Herwaarden
01-29-2005, 05:59 AM
If the data you need is already unserialized, you don't need to do it again.
You will just need something like "$eventfields['fieldname']" in your template.
To find out which fields are in the array, TEMPORARY add the following line to your php-script, just after the unserialize:
echo "<br />Eventfields: ";print_r($eventfields);
This wil show you the contents of the array.
DarrinM
01-29-2005, 06:19 AM
Thanks again Marco, will give that a try, I did notice however that when using ' within the template I get a parse error, what would be the correct format for the template when I have worked out what the variable is ?
Regards
Darrin
Marco van Herwaarden
01-29-2005, 06:22 AM
Sorry just leave out the quotes.
DarrinM
01-29-2005, 07:14 AM
Right, managed to get the eventfields to display but ONLY when viewing the posting and not in calendar month view by doing what you said - see screenshot
Entered $eventfields[1] and $eventfield[field1] into the calendar monthly view template - see below - but still did not display, I left the $event[customfields] in just for reference
<div class="smallfont" style="margin-bottom:$stylevar[cellpadding]px; padding-bottom:1px; border-bottom:1px solid">
<if condition="$show['holiday']">
<!--<strong>»</strong>--> <a href="calendar.php?$session[sessionurl]do=getinfo&day=$year-$month-$day&c=$calendarid" title="$event[preview]"><strong>$event[title]</strong></a>
<else />
<if condition="$show['subscribed']">
<img class="inlineimg" src="$stylevar[imgdir_misc]/subscribed_event.gif" alt="$vbphrase[event_notification]" />
<else />
<!--<strong>»</strong>-->
</if>
<a href="calendar.php?$session[sessionurl]do=getinfo&e=$event[eventid]&day=$year-$month-$day&c=$calendarid" title="$event[preview]">$event[title]</a>
$event[customfields] $eventfields[1] $eventfields[field1]
</if>
</div>
Hope you can assist
Regards Darrin
DarrinM
02-09-2005, 08:46 AM
MarcoH64 Kindly provided a fix for me and I am posting this for anyone else who requires it
Edit 'includes/functions_calendar.php'.
Find:
$event['title'] = htmlspecialchars_uni($event['title']);
Add after:
// Start Hack custom field on calendar month view (MarcoH64)
$customfield=unserialize($event['customfields']);
// End Hack custom field on calendar month view (MarcoH64)
Now edit the template 'calendar_monthly_event':
Find (or any other place):
<a href="calendar.php?$session[sessionurl]do=getinfo&e=$event[eventid]&day=$year-$month-$day&c=$calendarid" title="$event[preview]">$event[title]</a>
And add below (please change it to suit your needs/fieldnumbers):
<!-- Start Hack custom field on calendar month view (MarcoH64) -->
<br />$customfield[1] -
<if condition="$customfield['2'] == 'OFF'"><font color="red"><else /><font color="green"></if>
$customfield[2]
</font color></if>
<!-- EndHack custom field on calendar month view (MarcoH64) -->
Note: "OFF" is one of my custom fields drop down options, yours of course will be different
Many thanks to MarcoH64
phenomenon
04-15-2005, 07:44 AM
Ok I got this to work. Thank you very much guys! I am similarly trying to get the same type thing to show up in the weekly view. I have tried adding
$customfield=unserialize($event['customfields']);
to the calendar.php file in a similar place for the weekly view, but it didn't work. Any ideas on how to make the custom field show up in weekly view?
Thanks!
phenomenon
02-23-2006, 11:16 PM
To update this, you need to add the line of code to about line 493.
I had troubles searching for the line above, here it is again.
search for:
$event['title'] = htmlspecialchars_uni($event['title']);
and after add
// Start Hack custom field on calendar month view (MarcoH64)
$customfield=unserialize($event['customfields']);
// End Hack custom field on calendar month view (MarcoH64)
kj_ugs
07-03-2006, 04:58 PM
any progress on getting this to work on the weekly view? It'd be a huge help. The above code only seems to work on monthly views.
aycan555
09-18-2007, 11:31 PM
Hi guys i have got smiller problem, i have created two fields for my calendar, fields id's are 1 and 2 i want to show them in forumhome themplate like:
[costumfield id1] Events Title [costumfield id2]
Curently shows Event Title - Date
i want to read out the date any help please?
thank you..
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.