Is there anyway to insert something called with perch_content_custom() within a template?

  • I'm sure I'm trying to go about this in the wrongest of ways but:


    I have a template that has:


    [some editable content]


    [A styled list of content from another page]


    [The rest of the editable content]


    and I'm struggling to get my head round the best way to achieve this in perch3...


    The list of content from the other page is used there in a list / detail style setup with perch_content() and perch_content_custom() but I want to be able to insert that list into at least one other page. I thought I'd try it by adding a perch_content_custom() call to a layout then including that in the page content template but this hasn't worked and I'm presuming that it can't.


    Is there a way to make it work the way I'm doing it? Or is there another function of perch I should be using to do this sort of thing... "categories" for example?


    Of course, the easiest work around is to split the template into two regions on the page and put the perch_content_custom() between them... but ideally I'd like to make all the content editable on one template... I realise now, literally as I write this that I could display it twice with different templates which would solve that problem. The next question though would be... if I could... I'd love for the editor to be able to include or exclude the perch_content_custom call with a check box in the editor.... so the question is still worth asking!

  • drewm

    Approved the thread.
  • You can pass extra data into a template, so the solution is to request the content from the other page, and then pass that into the template so it can be used between the other content.



    In you region you can then add your listing HTML where you need it:


    Code
    1. <perch:content id="listing" type="hidden" encode="false">