Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)

Reply
 
Thread Tools Display Modes
  #1  
Old 01-28-2005, 02:21 PM
DarrinM DarrinM is offline
 
Join Date: Dec 2004
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Can it really be that difficult ?

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
Attached Images
File Type: jpg Untitled-3.jpg (9.4 KB, 0 views)
Reply With Quote
  #2  
Old 01-28-2005, 08:16 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you are trying to show a serialized array.

In your php script, first do:
PHP Code:
$mynewarray unserialize($serializedarray); 
Then use $mynewarray['field'] in your template.
Reply With Quote
  #3  
Old 01-28-2005, 09:27 PM
DarrinM DarrinM is offline
 
Join Date: Dec 2004
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #4  
Old 01-29-2005, 05:59 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
PHP Code:
echo "<br />Eventfields: ";print_r($eventfields); 
This wil show you the contents of the array.
Reply With Quote
  #5  
Old 01-29-2005, 06:19 AM
DarrinM DarrinM is offline
 
Join Date: Dec 2004
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #6  
Old 01-29-2005, 06:22 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry just leave out the quotes.
Reply With Quote
  #7  
Old 01-29-2005, 07:14 AM
DarrinM DarrinM is offline
 
Join Date: Dec 2004
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

HTML Code:
<div class="smallfont" style="margin-bottom:$stylevar[cellpadding]px; padding-bottom:1px; border-bottom:1px solid">
	<if condition="$show['holiday']">
		<!--<strong>&raquo;</strong>--> <a href="calendar.php?$session[sessionurl]do=getinfo&amp;day=$year-$month-$day&amp;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>&raquo;</strong>-->
		</if>
		<a href="calendar.php?$session[sessionurl]do=getinfo&amp;e=$event[eventid]&amp;day=$year-$month-$day&amp;c=$calendarid" title="$event[preview]">$event[title]</a>
$event[customfields] $eventfields[1] $eventfields[field1]
	</if>
</div>
Hope you can assist

Regards Darrin
Attached Images
File Type: jpg Untitled-2.jpg (14.1 KB, 0 views)
Reply With Quote
  #8  
Old 02-09-2005, 08:46 AM
DarrinM DarrinM is offline
 
Join Date: Dec 2004
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

MarcoH64 Kindly provided a fix for me and I am posting this for anyone else who requires it

Edit 'includes/functions_calendar.php'.

Find:

PHP Code:
$event['title'] =  htmlspecialchars_uni($event['title']); 
Add after:

PHP Code:
// 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):

Code:
<a href="calendar.php?$session[sessionurl]do=getinfo&amp;e=$event[eventid]&amp;day=$year-$month-$day&amp;c=$calendarid" title="$event[preview]">$event[title]</a>
And add below (please change it to suit your needs/fieldnumbers):

Code:
<!-- 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
Reply With Quote
  #9  
Old 04-15-2005, 07:44 AM
phenomenon phenomenon is offline
 
Join Date: Aug 2003
Location: Seattle, WA
Posts: 71
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #10  
Old 02-23-2006, 11:16 PM
phenomenon phenomenon is offline
 
Join Date: Aug 2003
Location: Seattle, WA
Posts: 71
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
Code:
$event['title'] =  htmlspecialchars_uni($event['title']);
and after add
Code:
// Start Hack custom field on calendar month view (MarcoH64) 
                            $customfield=unserialize($event['customfields']); 
// End Hack custom field on calendar month view (MarcoH64)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:41 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04271 seconds
  • Memory Usage 2,284KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (1)bbcode_html
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete