klox7 VIP
Total posts: 914
30 Янв 2014 08:20

Probably easy one but I need help...

I have a field which I don't want to be displayed in filed group output. So I disabled it for intro and full view. But I want same field to be displayed in custom position of template?

If I use this the field is hidden.

<?php if(isset($item->fields_by_id[12])): ?>

    <span class="field-year">

        <?php echo $item->fields_by_id[12]->result; ?>

    </span>

<?php endif; ?>

Последние изменения: 02 Март 2014


Sergey
Total posts: 13,748
31 Янв 2014 07:08

Right, unfortunately this is how it works. You can only operate by fields that are allowed in this view. This is done on purpose. Some fields may consume resources on render and view prepare all fields in advance.


pepperstreet VIP
Total posts: 3,837
31 Янв 2014 19:23

a field which I don't want to be displayed in filed group output

Do you mean the field output** loop**? You may fetch the respective field before that loop… and then unset it from the field array. see this docs article (hence last question at the bottom)


klox7 VIP
Total posts: 914
01 Фев 2014 10:16

Yes, I mean field output loop;)...and that's what I needed. But where to add fieldlist parameter? Example from link:

 <fields name="tmpl_params">

     <fieldset name="name1" label="Position Fields" 

         description="Set fields to be positioned">

         <field name="field_price" type="meresourcesfields" label="Where is the price?" />

     </fieldset>

 </fields>

Sergey
Total posts: 13,748
02 Фев 2014 23:57

What you want to do is to allow field in in list and full view but in template with loop make something like this

unset($item->fields_by_id[10])

depending on what field set is looped.

And it will not be in the loop.

Работает на Cobalt