Posts by Stephen Meehan

    Hi


    Noticed something when saving a page as a draft...


    • Before I press save I check the 'Save as draft' box
    • Press save and the 'Save as draft' box is unchecked?
    • I see the 'Draft successfully updated' message, but not the 'You are editing a draft' message?
    • As result the page (that I want to be a draft) is live on the website
    • When I view 'listing pages' there's no preview button next to the new page?
    • If I go back into the page, check 'Save as draft' box again and press save it remains checked.
    • Only then do I see the 'You are editing a draft' message?

    Here's a 40 second screen recording showing what's happening.


    I'd expect the 'Save as draft' box to remain checked and the 'You are editing a draft' message to be shown on the first save.


    Any ideas?:/




    Health check

    • Perch Runway is up to date
    • PHP 7.1.26 is up to date
    • MySQL 5.7.25 is up to date
    • Image processing available

    Hi


    I'm making a 'video guide' collection, using collections and categories. Most of my categories are single level, but one of them has a subcategory:

    • about
    • about/team

    On the /about category page it'd be handy to only show items categorised as about. It currently shows items from both about and team. I don't want any items from the subcategory team shown.


    As I can't filter perch_collection with catDepth, I was wondering what's the recommended way to achieve this? :/

    Hi Byron,


    Thanks for replying, that got me on the right track.


    However, I found the if statement triggered when I pressed submit - bypassing the form validation. I guess this is because lm_campaign_name_slug is present before the form is submitted. But it did get me thinking, I found this post, with a similar solution by hus_hmd.


    Inspired by both suggestions, I came up with this. Thanks Byron and Hussein 8)


    Using the code below I'm able to use novalidate on perch:form, Perch does all the validation I need, and the form redirects to a unique page. Perfect.


    I removed the action attribute from perch:form as it's no longer needed.


    Update...


    I always like to use novalidate on perch:form


    My opening tag looks like this

    Code
    1. <perch:form novalidate id="lead_magnet_form" method="post" action="<perch:content id="lm_campaign_name_slug">/downloads" app="perch_forms" class="form">
    2. // Redirect is dynamic, but Perch validation doesn't work?
    3. // Ideally I'd like to use Perch validation...


    Things I've tried

    Code
    1. <perch:form id="lead_magnet_form" method="post" action="<perch:content id="lm_campaign_name_slug">/downloads" app="perch_forms" class="form">
    2. // Removed novalidate attribute, browser takes care of validation
    3. // Prefer to use perch:error as I can customise messages and show them all at once.
    4. // Redirect is dynamic


    Code
    1. <perch:form novalidate id="lead_magnet_form" method="post" app="perch_forms" class="form">
    2. // Removed action attribute
    3. // Perch validation works
    4. // Redirect is not dynamic, needs to be set via settings in the CMS


    I suppose I could use perch:success tags, but it would involve changing the structure of the page template...



    Is there a way to use Perch form validation and action together?


    :/

    Hi


    I'm using a Collection and the Forms App to create a lead magnet/landing page. On form submission the page redirects to a 'download' page.


    This is the page structure:

    • www.domain.com/unique-slug
    • www.domain.com/unique-slug/downloads


    The problem is the redirect needs to contain a unique slug, because the download will be different for each campaign.


    Within the Forms App I can use an ID in curly braces to populate things like the Email subject line



    But curly braces don't appear to work in the redirection box in the Forms App settings page.



    Is there a way to use an ID to make the redirection dynamic?




    Another thing I've tried is to use the action attribute, like this:


    action="<perch:content id="lm_campaign_name_slug">/downloads"


    This redirects to the correct page (using a unique slug), but the form no longer validates.


    Is there an obvious solution to this I'm just not seeing?



    Health check

    • Perch Runway is up to date
    • PHP 7.1.26 is up to date
    • MySQL 5.7.25 is up to date
    • Image processing available

    Yes, I've just tried a simple demo


    Code
    1. <perch:if exists="perch_item_first">
    2. <perch:content id="post_title">
    3. <perch:else>
    4. <perch:before><ul></perch:before>
    5. <li><perch:content id="post_title"></li>
    6. <perch:after></ul></perch:after>
    7. </perch:if>


    You're right, perch:after is recognised, but perch:before isn't?


    I'd expect both to work, not just one?


    Any reason for this? Is there a workaround? :/

    Hi


    I'm using perch_collection to output a list of posts. I'd like to be able to style the first post (the newest post) in the list a bit different that the rest.


    Code
    1. perch_collection('News', [
    2. 'template' => 'path/to/template/news.html',
    3. ]);


    I was hoping to use perch_item_first like this:


    Code
    1. //news.html
    2. <perch:if exists="perch_item_first">
    3. <perch:template path="path/to/template/latest.html" />
    4. <perch:else>
    5. <perch:template path="path/to/template/list.html" />
    6. </perch:if>


    list.html is using <perch:before> and <perch:after> tags, but they aren't being picked up by Perch?


    Is this intentional?



    The <perch:before> and <perch:after> tags work as expected when I move list.html out of the <perch:if>

    Hi Hussein,


    Yes, I was thinking I might just use a second category set.


    I wonder, would there be any reason to not include all the categories in one category set? I guess it'll be more of a user interface issue than limiting any filtering I might need to do with multiple category sets.


    I'm working on website that needs quite a few nested sub categories, just trying to decide the best way to structure them.


    Thanks for the reply!

    Hi


    The Blog App has perch_blog_tags() is there anything similar for collections?


    I'm using a collection, instead of the Blog App and the only feature I'm missing is the ability to tag posts.


    Is this possible?


    :/

    hus_hmd thanks, ideally some sort of focus based cropping should be part of Perch core. The imgix service isn't expensive, and I really like the work you've done to make this work with Perch, however it's one more cost for something that I feel isn't unreasonable to be part of Perch.

    Hi


    Just spotted this on a client website...




    It'd be so useful to be able to click on a focal point in an image and set that as the crop, instead of the default 'crop from the middle'.


    Many other Content Management Systems have this feature:

    1. [Umbraco](https://our.umbraco.org/docume…e-cropper#set-focal-point)
    2. [CraftCMS](https://github.com/smcyr/Craft-FocusPoint)
    3. [Squarespace.com](https://support.squarespace.co…l-points-to-center-images)
    4. [Wix.com](https://support.wix.com/en/art…o-in-the-wix-pro-gallery#)
    5. [Silverstripe](https://www.silverstripe.org/b…ropping-for-silverstripe/
    6. [Sitecore](https://inverseproportion.word…ocus-cropper-in-sitecore/)

    The links above come from this GitHub [post](https://github.com/processwire…swire-requests/issues/150).



    Can we expect image cropping options in Perch 4?

    I can see in the docs, we can use id="count.blog.post" to output category count tags.


    Is there a way to do a category count with a collection?


    I'm trying to achieve this:

    • Cars (12)
    • Boats (9)
    • Planes (3)

    Cars, Boats and Planes are categories assigned to a collection. The numbers indicate the number of posts in each category.


    Can I do this with categories & collections? Or is a category count only available when using categories & Blog App?

    Hi,


    The Blog App allows me to display the number of posts associated with a category.


    I can list all the categories and display a number next to each category title. Like this:

    • Cars (12)
    • Boats (9)
    • Planes (3)

    Is there a way to do this with a 'Collection'? I'm considering using a 'Collection' instead of the Blog App

    Hi,


    The template setup below works, until I try to use rescope="parent"


    Code
    1. <perch:blocks>
    2. <perch:block type="Image" label="Image">
    3. <perch:template path="path/to/template.html">
    4. </perch:block>
    5. </perch:blocks>


    template.html also includes a perch:template



    When I add rescope="parent" , the nested perch:template doesn't work properly...


    Code
    1. <perch:blocks>
    2. <perch:block type="Image" label="Image">
    3. <perch:template path="path/to/template.html" rescope="parent">
    4. </perch:block>
    5. </perch:blocks>


    • In this example the template.html is an image
    • The template fields appear in the CMS, but when I press save, there's no output?
    • When I look in the source, I can see the template HTML is being output, but it's missing the image path


    Perch Runway: 3.1.3