Fork me on GitHub

[Pagesetter] Get field data from child pub into parent pub  Bottom

  • Here's the situation:

    I have two pubtypes which are related to each other. The "parent" pubtype displays the selected publication from the "child" pubtype. When viewing the child publications, the parent pubs they are related to are not shown (set to hidden in the pubtype).

    From a parent publication, I want to display all of the fields from the related child publication, but not all together in a list. That is, I need to display each child field in a different area of the parent full template.

    So in the parent's full template, the structure would be something like this:

    • some code
    • child pub field 'title'
    • more code
    • child pub field 'description'
    • more code
    • child pub field 'notes'
    • more code


    I hope that makes some sense. With some help from Darryl, I know how to display all of the child fields at once based on a special template created for the child using the createFilter and inlinePubList plugins. However, that places all of the child fields in the parent wherever I place the calls to those plugins -- I need to extract those fields one at a time throughout the parent's full template.

    My initial thought is to somehow pull them all into an array in the parent's full template and then display them as needed. However, I'm not sure how to do that or if it is even the proper way to do it.

    Thanks!!
  • I don't know if I understood correctly and if there is an easier or better solution but usually in my sites I use more than one inlinePubList plugin.
    I copy the one in the original distribution and I call them

    function.pagesetter_inlinePubList2.php
    function.pagesetter_inlinePubList3.php
    function.pagesetter_inlinePubList4.php

    of course you have to modify the code and rename all reference inside the plugin from inlinePubList to

    inlinePubList2
    inlinePubList3
    inlinePubList4

    then you have also to create the templates with the same names

    yourPub-inlineList2.html
    yourPub-inlineList3.html
    yourPub-inlineList4.html

    and inside each templates the fields you need...



    edited by: arkanoyd, Sep 21, 2009 - 01:01 AM
  • You do not need to copy plugin inlinePubList.
    Just create the templates:

    yourPub-inlineList1.html
    yourPub-inlineList2.html
    yourPub-inlineList3.html

    in the parent's full template:

    Code

    some code
    <!--[pagesetter_inlinePubList tid=TID filter=$f tpl=inlineList1]-->
    more code
    <!--[pagesetter_inlinePubList tid=TID filter=$f tpl=inlineList2]-->
    more code
    <!--[pagesetter_inlinePubList tid=TID filter=$f tpl=inlineList3]-->
    more code
  • vv

    You do not need to copy plugin inlinePubList.


    I had initially envisioned it being something like this, but then I got to thinking there had to be a better way. Apparently there isn't! But after reading your solution, it doesn't look quite as bad as I had expected.

    Thanks for the responses! icon_cool
  • One thing worth noting: I added a call to the createFilter plugin to the top of my parent template:

    Code

    <!--[pagesetter_createFilter filter="FIELD:rel:`$core.pid`" assign=f]-->
    ... where FIELD is the field name in the child pubtype.
  • I have a similar constellation and use the same approach, it works well for me.

    Question: I have some search functionality in my parent list header, which filters for information in the parent publication type. Unfortunately, I have not been able to extend this filter system to also search through the child publication type. Any suggestions?

This list is based on users active over the last 60 minutes.