Posts by owainbrowne

    When I first built a site for someone using perch pages weren't a thing and I've never used them as I usually build my own site structure then use perch as a "drop in" CMS...


    I should definitely explore the functionality more.


    Just to understand how this is working... the variable from the template is stored when the editor clicks "save"... but the "perch:layout" function runs at runtime when perch:content is called in the page?

    Again, this may not be the best way to go about this but in any case it's working and I wanted to check it's supported behaviour:


    I have a global.header.php template with a couple of variables which I was calling in the page with


    PHP
    1. <?php perch_layout ('global.header', array(
    2.     'page' => 'about',
    3.     'background' => 'some-image.jpg',
    4.     )); ?>
    5.     

    but anticipating my users wanting to be able to edit a couple of things (the background image for instance) in that header on a page by page basis I thought I would try calling it in a template like this:


    Code
    1. <perch:layout path="global.header" page="courses" background="<perch:content id="header_image" type="image" required label="Header Image">">


    which works absolutely fine... I just wondered if that's a sensible way to do it and if there's any advantages / disadvantages to this approach vs a content template include.


    ...an to check it was supported behaviour as I said as I couldn't find it as an example usage in the docs.


    Owain

    As said above, if you want to pass a variable into the template you need it to be processed at runtime with perch_content_custom()...


    But in this case, would <perch:content id="_page" type="hidden"> be useful to you?


    It outputs the page itself which you could relate to the title someway?


    If it's essential to have the variable available to your template and you don't want to process the template at runtime this might be a way to solve it... or at least work round.

    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!

    Question is in the subject... am building a simple html description list to be edited by the user but would like it to be possible to have multiple <dd></dd> pairs under some of the <dt></dt> pairs... I'd like to keep the editor interface as simple as possible here so for me the easiest thing would be a Textarea that in the template adds <dd></dd> tags to each new line.


    Is this something that can be achieved simply within perch or do I need to write some sort of basic .js and set it up as an editor? (Not something that I would know how to do but might be worth the learning experience if it's a sane approach.)


    Or is there another way entirely I should be trying to do this? I'd rather not go down the route of nested blocks / repeaters for it...