klox7 VIP
Total posts: 914
27 May 2014 19:22

Hello,

as said in title can I display fields in list template based on type id? Something like if type id is some number then show this field.

Regards

Last Modified: 28 May 2014


Sergey
Total posts: 13,748
28 May 2014 05:21

Yes, if you use $item->fields_by_id[1111]->result then you get field of particular type. Did you read article about custom templates?


klox7 VIP
Total posts: 914
28 May 2014 07:48

Of course :S. I'm doing custom template for child items in record view and I have several child types but I want to use one template and I thought that I have to specify type.

But what about if I want different titles for different types (h2 for one and h4 for other). In template there is this code:

<?php if($this->submission_types[$item->type_id]->params->get('properties.item_title')):?>

Can I assign specific type id to upper code?


pepperstreet VIP
Total posts: 3,837
28 May 2014 20:39

Sergey Yes, if you use $item-&gt;fields_by_id[1111]-&gt;result then you get field of particular type. Did you read article about custom templates?

I guess, klox7 is talking of content type id. Not the field's type.

I could not find any info about content types in template docs. i.e. how to fetch fields for a certain (content)type only. Or how to check to which (content)type a field belongs to.


Sergey
Total posts: 13,748
28 May 2014 23:44

pepperstreet how to fetch fields for a certain (content)type only.

One article one content type. that is why all fields are in $item no matter what type it is.

klox7 Can I assign specific type id to upper code?

Yes you can use digit instead of $item->type_id. Eg $this->submission_types[11]->params. But only those types that are connected to this section.

Powered by Cobalt