Posts by Stephen Meehan

    Hi


    I'm trying to access a category set within a perch_collection, but when I run echo all that's output is the word Array?


    Code
    1. $wlrs_cats = perch_collection('Opportunities', [
    2. 'skip-template' => 'true',
    3. 'return-html' => 'true',
    4. 'filter' => 'opp_name_slug',
    5. 'match' => 'eq',
    6. 'value' => perch_get('s'),
    7. ]);
    8. echo $wlrs_cats[0]['content_type']; // Opportunity categories - outputs 'Array'?
    9. echo $wlrs_cats[0]['opp_name']; // Opportunity name - outputs name as expected.


    How do I output the full Array, I'm expecting to echo a string of all the selected categories.:/

    Hi,


    When using perch:related it'd be great if the order can be changed within perch:related. At the moment the order is dictated by the order of items in the collection, the order can't be overridden within perch:related?


    • 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

    hus_hmd has created a very neat perch add-on which solves this problem.


    Here's the code I'm using to output items from multiple collections


    Within my post--listing.html template I added <perch:content id="collectionKey" urlify>, this takes the collectionKey and converts it into a slug friendly value.


    The post--listing.html template can now display a unique ahref based on its collection name (collectionKey).




    Download the Pipit add-on here:

    https://github.com/Pipits/pipit/releases/tag/v0.4-beta

    Hi,


    I'm using a list and detail setup to display posts from two collections , it works well but I'd like to be able to use the collectionKey within the template.


    If I can expose it I intend to use it in the ahref, like this:

    • website.com/case-studies/post-name/
    • website.com/posts/post-name/


    Using define('PERCH_DEBUG', true); I can see this in the Debug message


    SELECT collectionID, collectionTemplate FROM perch3_collections WHERE (collectionKey='Posts' OR collectionKey='Case Studies')


    If I can expose the collectionKey somehow, I'm hoping it'll be possible to manipulate it with PHP to make it slug friendly and use PerchSystem::set_var to make it visible to my perch template. :/

    Hi,


    I'm working on a Perch Runway website that is likely to have a lot (a lot) of content added to over the next few years.


    I'm trying to figure out the best way to structure it and would welcome any input.


    There will be four main sections

    1. Blog
    2. Case Studies
    3. Publications
    4. Resources

    If this was a smaller website, I'd most likely use a single 'Collection' and use 'Categories' for each section.


    I like the idea of separating out the different types of content into individual 'Collections', hopefully this should make it easier to manage in the CMS. Plus give me the option to use a different post template for each 'Collection' if needed.


    Each 'Collection' will use two 'Category Sets', I intend to use the 'Category Sets' to filter the 'Collections'. This all seems fairly standard so far...


    One of the 'Category Sets' will be called 'Themes'. For example, one of the 'Themes' would be 'Mental health'


    In each 'Collection' there might be content categorised as 'Mental health', I'd like to display a 'Latest' page, which would list the newest content from all four 'Collections' categorised as 'Mental health'. This is very simple to do if all the content was in a single 'Collection'.


    Is it possible to combine content from multiple 'Collections' in this way? :/


    Code
    1. perch_collection('Blog', ['template' => 'blog-template.html','category' => perch_get('cat'),]);
    2. perch_collection('Case Studies', ['template' => 'case-template.html''category' => perch_get('cat'),,]);
    3. perch_collection('Publications', ['template' => 'pub-template.html','category' => perch_get('cat'),]);
    4. perch_collection('Resources', ['template' => 'resource-template.html','category' => perch_get('cat'),]);

    There is so much support for Perch, everyone (in the Slack group) wants it to succeed and grow. The current buy once and receive free support/updates forever obviously isn't sustainable. I welcome a move to an annual license update.


    However, it really needs to be backed up with an increase in development for both Perch and Perch Runway. There's a lot of uncertainty in the Slack group regarding the future of Perch CMS. Ongoing development seems to be in maintenance mode, a look at the update history page isn't very encouraging.


    The Perch 4 announcement earlier this year, followed by radio silence until this week has only made that uncertainty worse.


    Can we expect a return to the 'glory days' of Perch back in 2015/16/17 when development was very active and there was a real buzz about Perch?

    Hi


    I appreciate this isn't technically a Perch question


    I'm using Sequel Pro on the Mac, after a bit of searching, it looks like I can use a Query like this to find and replace


    SQL
    1. UPDATE perch2_blog_posts SET postTitle = replace(postTitle, 'ABC Widgets', 'XYZ Widgets');


    • Is this a safe way to replace text in a database?
    • Is there a good way to search the entire database to see what tables/columns contain a word I'd like to replace?


    Any pointers would be appreciated. :/

    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?


    :/