Posts by hus_hmd

    I get what you're trying to accomplish. It wasn't clear what exactly isn't working from the original post so I wanted to double check before suggesting anything.


    So you have added the URL pattern [en|fr:lang] (no slash at the start) to the home page /, but visiting both /en and /fr gets you a 404.


    Routes work fine on / in general. Have you tested other routes on the same page?

    Hello Jade,


    You have Perch template tags in your PHP file. They won't be rendered correctly this way. If you have the Forms app installed, you can use perch_form() to output your form.



    The other thing that may cause you problems is how you're always applying the filters regardless of whether the filtering options are selected. You can add your filters more dynamically like so:


    Hi tidygraphic,


    Do you get any errors in your browser console?



    All your ids are the same in each block


    I don't think this would be a problem. Each block is like a mini-template by itself (much like repeater items). As long as the type attribute on the perch:block tags are unique, I don't think this would be an issue. I heavily re-use the same IDs inside different perch:block tags for consistency (and my sanity).

    Hello Nick,


    The Blog app is for date-ordered content (particularly blog posts). From the docs:



    We sometimes see people trying to use the Blog App for things that are not a blog or news listing. This is not usually what you want to do. All of the filtering, sorting and category functionality is available in regular Perch Content. Try using that before attempting to turn Blog into something it isn’t!


    Like Jade mentioned, you can use Perch Content for what you're after. You can create a multiple-item region for your projects:


    PHP
    1. perch_content_create('Projects', [
    2. 'template' => 'project.html',
    3. 'multiple' => true,
    4. 'edit-mode' => 'listdetail',
    5. ]);


    And you can display the items with perch_content_custom(). You can use the same filtering syntax you're used to using with the Blog app.

    Hi ryan,


    In register_app(), you can set the last argument to true and it won't be included in the menu:


    PHP
    1. $this->register_app('my_app', 'My App', 99, 'A Hidden App', '1.0', true);


    If you've already registered the app, you may need to remove the app via the Menu Manager in Runway or rebuild the menu in regular Perch (Settings > Diagnostics > Add-ons).

    Hello Lee,


    On my portfolio site, I've set it up so I can create new pages which include a content template to fill in project details


    You may want to consider using a multiple-item region instead of pages.


    To create the region:

    PHP
    1. perch_content_create('Projects', [
    2. 'template' => 'project.html',
    3. 'multiple' => true,
    4. 'edit-mode' => 'listdetail',
    5. ]);


    Displaying a list of the projects would be similar to what you're used to in the Blog app:


    PHP
    1. perch_content_custom('Projects', [
    2. 'template' => 'projects_list.html',
    3. ]);


    And you can filter the list to exclude what you don't want:


    PHP
    1. perch_content_custom('Projects', [
    2. 'template' => 'projects_list.html',
    3. 'filter' => 'slug',
    4. 'match' => 'neq',
    5. 'value' => perch_get('s')
    6. ]);

    Hell xenowebdev


    Assuming perch_get('cat') gets you the catSlug, you can use conditional tags to check which category is selected and add the selected attribute to the matching <option> tag:


    HTML
    1. <perch:if id="page_cat" match="eq" value="{catSlug}">selected</perch:if>
    HTML
    1. <option value="/community/<perch:category id="catSlug" type="slug" for="catTitle" />/" <perch:if id="page_cat" match="eq" value="{catSlug}">selected</perch:if>>
    2. <perch:category id="catTitle" type="smarttext" />
    3. </option>

    Hi,


    In Perch Shop, at the moment to determine whether the cart has items that require shipping you need to get the cart items and loop through the items. Something like:


    PHP
    1. $cart = perch_shop_cart(['skip-template' => true]);
    2. $require_shipping = false;
    3. foreach($cart['items'] as $item) {
    4. $product_fields = json_decode($item['Product']->productDynamicFields());
    5. if($product_fields->requires_shipping) $require_shipping = true;
    6. }
    7. if(!$require_shipping) {
    8. PerchSystem::redirect('/cart/next-step/');
    9. }


    It would be nice if there was a function like perch_shop_cart_has_shippable_items():


    PHP
    1. if(!perch_shop_cart_has_shippable_items()) {
    2. PerchSystem::redirect('/cart/next-step/');
    3. }
    PHP
    1. if(perch_shop_cart_has_shippable_items()) {
    2. perch_shop_shipping_method_form();
    3. }



    I realise I can use perch_shop_get_shipping_weight() and check whether the weight is over 0, but this assumes that all products that require shipping have a shipping weight set. A more explicit function would be appreciated.



    Thanks

    Hi montlewis,


    1. Should the next attribute work with perch:members forms?


    Yes. It's specific to the Members app. It redirects the user to the specified URL after a successful submission.


    In your form, the next attribute can hold a hardcoded value like next="/account". This value cannot be dynamic.


    2. Is {returnURL} something created by Perch?

    {returnURL} can be used by the Members app in emails sent by the app (e.g. welcome email). Though It's not necessary to use in emails as you can always hardcode the login page URL in your email templates.

    The Blog app doesn't require you to use the full category path. It prefixes the category path with blog/ under the hood.


    Elsewhere in Perch, you can filter items by multiple categories from different category sets. So you need to use the full category path e.g. strengthening/neck/.



    PHP
    1. if(perch_get('cat')) {
    2. perch_collection('Strengthening', [
    3. 'category' => 'strengthening/' . perch_get('cat') . '/'
    4. ]);
    5. }

    Most of my clients aren't the site maintainers themselves, so I rarely get to explain the content management features Perch has to offer myself. Generally, I think many don't know the feature exists.


    The only instance I remember I had to roll back a change was on a staging environment when the client wanted to make a big content change to a region, but they were almost certain they wanted to go back to the original version. They just mentioned it in passing and I showed them how to roll back.


    In terms of UX, I like the Revision History tab on multiple-item regions. It seems it's only visible when the editing mode is set to listdetail. I like how it shows the available versions, when they were created and by which user.


    The Undo button on the other hand just reverts to the previous version. I don't like how it doesn't ask you to confirm the action particularly because it also looks like a tab itself. If the behaviour was similar to the Revision History tab, I might use it more or introduce more clients to the feature.



    tldr; I rarely use the revision system. While it's good to know it's there, I don't think I'd miss it if you were to remove it. If you opt to keep it, I would prefer the behaviour of the Revision History tab to that of the current Undo button.

    Hi Matt,


    I don't think the YouTube field type at its current implementation prevents you from doing that. What is your desired markup?


    If what you need is:


    HTML
    1. <iframe class="lazy" data-src="https://www.youtube.com/embed/{videoID}" poster="lazy.jpg"></iframe>


    Then you should be able to use output="youtubeID":

    HTML
    1. <iframe class="lazy" data-src="https://www.youtube.com/embed/<perch:content id="video" type="youtube" output="youtubeID">" poster="lazy.jpg"></iframe>

    I tested the re-indexing into a custom table approach first. Performance definitely improved, but updating Collection items via the Import API was still slow (because I was still indexing into the default index table). I also tried not indexing any fields into the default index table, but this meant I/editors couldn't locate items easily via the control panel (search and sort didn't work).


    I figured there's no reason why I shouldn't embrace Perch Runway for the framework it is and take full advantage of the Perch API. So I ended up building a full-featured custom app.


    Runway Collections is not the limit of a Runway project. You just need to look past the CMS. Perch is more than that. drewm and rachelandrew just don't brag enough about it :burd1fly: