klox7 VIP
Total posts: 914
09 Sep 2014 17:56

Hi,

I have 2 types that have child field in them for another 'parent' type. I would like to display links to child records in this 'parent' type record. I can't do this with parent field since I can't select multiple types and sections.

Child 1 - child field (I can add and attach Parent record here)
Child 2 - child field (I can add and attach Parent record here)
Parent - no parent field*

I'm asking for help how to do this with php.

I'm trying with

<?php
$child = ItemsStore::getRecord($this->item->child_id);
echo 'Child:&nbsp;' . '<a href="'.JRoute::_(Url::record($child->id)).'">'.$child->title.'</a>';
?>

This acctualy displays title of parent record (the one I'm viewing). Do I have to set up parent field* in parent type? If so, how to select multiple types and sections etc?

Regards

Last Modified: 10 Sep 2014


Konstantin
Total posts: 1,113
10 Sep 2014 09:11

Where are you get child_id here "$this->item->child_id" ?


klox7 VIP
Total posts: 914
10 Sep 2014 09:49

Konstantin Where are you get child_id here "$this->item->child_id" ?

Yes. Or is it $item->child_id or something else? Where can I see that?


Konstantin
Total posts: 1,113
10 Sep 2014 10:46

I think you must use parent field value, just create a custom template for output.


Sergey
Total posts: 13,748
10 Sep 2014 13:31

There is no child_id property. You have to look into $item->fields_by_id[10]->value and there have to be list of IDs of parent.

Powered by Cobalt