Ankündigung

Einklappen
Keine Ankündigung bisher.

Child tl_content as part of a page template

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Child tl_content as part of a page template

    I wanted to have child elements (tl_content) show up on the page of the parent. Quite similar to the demo portfolio but with the page showing both content from parent cc_portfolio and child tl_content.

    With the help from support I found a solution for this issue. Here is the solution:
    The reader reacts either to the detail entry url or to a tl_content table plus a pid get parameter. See the difference in the url !!
    To render ( in a regular detail page ) the content of the connected tl_content entries you need more logic in the template.
    You can use something like this in the reader template (create a new customcatalog_default Template)

    PHP-Code:
    <?php
    $objCC 
    $this->getCustomCatalog();
    $objContentEntries $objCC->fetchPublishedContentElementsById$this->entries[0]->id );
    echo 
    $objCC->renderContentElements($objContentEntries);
    ?>
    This worked for me in a test environment.



    Zuletzt geändert von Tim; 19.11.2015, 12:22.

  • #2
    Just to complete the list:

    Sure you can also render the content elements in a list template using the same way. (list and reader are basically the same. The reader array length is only 1. That's the main difference)

    PHP-Code:
    <?php
    $objCC 
    $this->getCustomCatalog();
    foreach(
    $this->entries as $entry)
    {
        
    $objContentEntries $objCC->fetchPublishedContentElementsById$entry->field('id')->value() );
        echo 
    $objCC->renderContentElements$objContentEntries );

    }
    ?>

    Also correct in the reader module template is a direkt call to the field() method, retrieving the current entry record

    PHP-Code:
    $objContentEntries $objCC->fetchPublishedContentElementsById$this->field('id')->value() ); 
    http://www.premium-contao-themes.com

    Kommentar

    Lädt...
    X