Blocks shown twice when combined from a group of pages.

  • Probably pushing my luck a little bit here with Perch standard, I'm trying to combine a specific block (logos) from a group of pages.


    I'm grabbing the regions from all of the children of the products page.


    Then switching the page content template to one that only shows the block I want.


    It's kinda working but I'm getting two copies of the block for some pages and not others?

    The pattern I've noticed is that if the logos block is first in the list on the page builder (ie no other different blocks before it), the block is shown twice?

  • Is it possible to only return the $item if it is different to the previous item?


    Code
    1. $product = perch_content_custom(array('Page Content'), array(
    2. 'page' => $path,
    3. 'template' => '_homepage/block_id.html',
    4. 'each' => function($item) {
    5. return $item; /* Can this only be shown if different to previous */
    6. },
    7. ));
  • Can anyone help here?


    I'm trying to call a region called 'Page Content' from multiple pages and show a certain type of block from that page.



    When using a basic template such as:

    Code
    1. <perch:content id="title" type="text" />

    It returns the page titles of the pages fine.


    However when adding the blocks code to the template (I've simplified the blocks template to only show the id so I can try and work out what is happening):


    Code
    1. <perch:content id="title" type="text" />
    2. <perch:blocks scope-parent="true">
    3. <perch:block type="manufacturers" label="Manufacturers" scope-parent="true">
    4. <perch:content id="_block_id" type="text" />
    5. <perch:showall>
    6. </perch:block>
    7. </perch:blocks>


    The page titles don't show for some pages, other pages are missing and some pages are repeated.

  • Fixed the issue.


    When using an alternative template for displaying the blocks, it's important all the block tags remain in the template - even if the markup between the tags is removed.


    eg, my template ended up looking like:


    Only the markup between the block I wanted was left in the template.