klox7 VIP
Total posts: 914
17 Jun 2014 18:50

Let's say we have 2 types and 2 section, each for every type. One type is parent and other type is child. If I want to create relations and attach children I have to create "parent field" in parent type. This gives me ability to display children in parent record with attach option.

Do I have an option if I attach child record in parent record it will auto create some kind of parent link in child record?

Last Modified: 20 Jun 2014


Sergey
Total posts: 13,748
18 Jun 2014 03:20

All connections are double side. no matter if you select parent in child or child in parent it is connection and will be visible on both sides.


klox7 VIP
Total posts: 914
18 Jun 2014 10:11

But how? So if I have parent field in my parent type I display it by adding field to my template, do I have to add this same field in my template of child?


Sergey
Total posts: 13,748
18 Jun 2014 11:50

In the Child you have to have Child field.


klox7 VIP
Total posts: 914
18 Jun 2014 13:49

Oh thanks. How would you display just the title of parent record? With echo $item->fields_by_id[ID]->...?


pepperstreet VIP
Total posts: 3,837
18 Jun 2014 15:17

klox7 How would you display just the title of parent record?

Apart from custom template...

In Child-field parameters you can choose any suitable template for list and for full view. e.g. simple_list

See first 2 parameters:

Bildschirmfoto 2014-06-18 um 16.54.46

In template config, you may hide any other parent type field in exclude parameter, and hide all other unwanted stuff with YES/NO in records elements.


@Sergey I noticed a small issue. The template parameters are used for BOTH template overrides. If you set the same override template for FULL and LIST view... you can't have different settings?! One template setting changes the other template. Shouldn't it work as usual? I mean, independently.


klox7 VIP
Total posts: 914
19 Jun 2014 05:49

pepperstreet In Child-field parameters you can choose any suitable template for list and for full view. e.g. simple_list

Hey pepperstreet, yes I know about parameters template but it seems better, at least to me, for that kind of stuff to control in custom template with php. It would be nice though to have in detail Cobalt API guide somewhere for this things.


Sergey
Total posts: 13,748
20 Jun 2014 03:12

pepperstreet @Sergey I noticed a small issue. The template parameters are used for BOTH template overrides. If you set the same override template for FULL and LIST view... you can't have different settings?! One template setting changes the other template. Shouldn't it work like ususal? I mean, independently.

I see. I missed that. I'll try to fix but will work only with new setups. Old will continue to ovveride since configuration key have been already created and attached. And those are both the same.

Powered by Cobalt