XF 2.0 Calling upon Custom Thread Fields and Performance Impact

ManagerJosh

Well-known member
What's the proper way of calling about a select number of custom thread fields on showthread (still learning template names) and what's the performance impact generally?
 
If you're viewing a thread, the thread field values for that thread are already available in $thread.custom_fields. Essentially no overhead.
 
I believe the information should generally be available there as well without significant overhead. The main detection would probably be by looking at the queries run on a page -- if you start seeing a similar query running over and over, then that would indicate that data is only being loaded on demand.
 
I believe the information should generally be available there as well without significant overhead. The main detection would probably be by looking at the queries run on a page -- if you start seeing a similar query running over and over, then that would indicate that data is only being loaded on demand.

If we wanted to show only
Code:
custom_field_1
and
Code:
custom_field_3
but not
Code:
custom_field 2
on the list of all threads?
 
You'd need to call each value individually ($thread.customer_fields.custom_field_1) wherever you want it to display.
 
You'd need to call each value individually ($thread.customer_fields.custom_field_1) wherever you want it to display.

I must be doing something wrong. I inserted the following in and it's not generating the result I was hoping for..

Code:
<xf:macro template="custom_fields_macros" name="custom_fields_view"
                                    arg-type="threads"
                                    arg-group="before"
                                    arg-onlyInclude="{$thread.Forum.field_cache}"
                                    arg-set="{$thread.custom_fields.custom_field_1}"
                                    arg-wrapperClass="message-fields message-fields--before" />
 
Oh, you're using the macro which is for multiple fields. You need to pass it a set of custom fields then, so $thread.custom_fields. If you want to filter that to multiple fields you can change the onlyInclude argument (provided the format matches the field cache).
 
Oh, you're using the macro which is for multiple fields. You need to pass it a set of custom fields then, so $thread.custom_fields. If you want to filter that to multiple fields you can change the onlyInclude argument (provided the format matches the field cache).
Hi @Mike, @Chris D . I am using $thread.customer_fields.custom_field_1 to display customer field. Its only work if I used text box Field type. If I used Radio buttons, Drop down selection , Multiple-choice drop down ... its just display Value ( value_a_z_0_9_and_only). I like to display Text. How can I do that? please help
 
its here, if you still need it
{$thread.custom_fields.getFormattedValue('fieldID')}
How did you do it?
i try this
Code:
div class="structItem-minor">
    <ul class="structItem-parts">
        <xf:if is="{$thread.custom_fields.getFormattedValue('fieldID')}">
            <li>Tipo de chollo: {$thread.custom_fields.getFormattedValue('fieldID')}</li>
        </xf:if>       
    </ul>
</div>

in fieIdID i put my name of the fild but not work...
I'm doing with check value or radio
 
My solution for display radio and check box

tipos_chollos is the NAME of the field.

Code:
<div class="structItem-minor">
                <ul class="structItem-parts">       
                     <xf:if is="$thread.custom_fields.tipos_chollos">
                            <li>{$thread.custom_fields.getFormattedValue('tipos_chollos')|raw}</li>            
                     </xf:if>        
                </ul>
            </div>
 
Top Bottom