vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Can it really be that difficult ? (https://vborg.vbsupport.ru/showthread.php?t=75304)

DarrinM 01-28-2005 02:21 PM

Can it really be that difficult ?
 
1 Attachment(s)
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:
PHP Code:

$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:
PHP Code:

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

1 Attachment(s)
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

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:

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

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:
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)



All times are GMT. The time now is 07:44 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01698 seconds
  • Memory Usage 1,748KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_html_printable
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete