Posts by hus_hmd

    since I used perch_content_create() there's no region, so I think that's not going to work

    perch_content_create() creates a region if it doesn't already exist. So this won't prevent you from using the dataselect field type.



    Also I'm unsure whether that can do multiple Projects anyway.

    If the dataselect field type does not support selecting multiple items, you can use repeaters!

    Why not use the Perch Gallery addon?


    The issue with the Gallery app is not only that it is not being maintained, but also the fact that it does not use the central assets system. This means if the editor wants to use the same image in different parts of the site besides the gallery (e.g. a blog post or a content region), they'd need to upload the same image twice.

    You can use the html attribute for this:


    HTML
    1. <perch:content id="code" type="textarea" label="Code" html>


    In fact, Perch ships with a sample template for this perch/templates/content/code_block.html

    For example, on a Florist website where you are shown extra items to buy with your flowers, such as a balloon, card, etc. These would be shown on the product detail page and can be ordered directly from that page alongside the main product.


    This can be achieved in different ways.


    For example, these items can be added as options and you'd have variants like:

    • Flowers
    • Flowers + [colour] balloon
    • Flowers + [colour] balloon + card


    The UI on the page doesn't have to be a list of form inputs. You still have some flexibility.



    Another approach is to have separate products and link them in some way (e.g. categories, or by relating products with the productlist field type). Adding different products to the cart at once is possible (if not through Perch Shop's existing functionality, it would be possible to write a custom add-on to do this).

    Would it help if I uncheck "Edit all items on one page"?

    Yes, possibly! PHP by default has a maximum of 1000 input variables (CMS fields in this case) - see max_input_vars. So by having that many items in a single form yo'll eventually hit that maximum. I would uncheck the option and manage each item on its own page.



    However, given that now 450 is a lot of entries, is there an easy way to delete multiple items quickly?

    There's no way to do this currently as far as I know.

    449 items is probably more than what a multiple-items region was designed to handle. Though this doesn't explain why you are unable to add more items.


    Which editing mode do you have enabled? Do you edit all items on a single page (i.e. you have the "Edit all on one page" option enabled)?

    If these image variations used to exist and now do not, it might be worth looking into what happened. Does the resources table still have a record of the missing variations?


    If you know a Perch asset with ID 37 has missing variations, you can query the database to check if Perch has a record of the variations - assuming your PERCH_DB_PREFIX is perch3_:


    SQL
    1. SELECT * FROM `perch3_resources` WHERE `resourceParentID` = 37




    There are 2 types of asset variations:

    1. Thumbnails: these are generated by default
    2. Other variations you specify in templates e.g.:
    HTML
    1. <perch:content id="image" type="image" width="400" crop>



    For (1), it is technically possible to write a script to regenerate those. I recently had a problem with S3 thumbnails so I wrote a scheduled task to periodically fetch any assets with no thumbnails and regenerate them.


    For (2), I don't have a solution for this. I don't think republishing all pages would regenerate these.

    Hi Peter,


    Can you share more details on how this content is managed? Are you using a multiple-item region? Or a single-item region that contains perch:blocks?

    You helped me do this in this thread: Use The Image In A Blog Post In Search Results


    When I suggested that approach in that thread I think I was under the impression you were searching content from multiple sources (not just the blog app). Now that I realise you're only searching blog posts, I'm suggesting you simplify the way you handle the search. This means you will need to modify some templates, but this is not a bad thing.


    It is not a huge change by the way. If you're unsure how to set up the template (or unsure why it is not working), post the desired HTML and either me or someone else would certainly help you.

    Since you're now using perch_blog_custom(), your template needs to be in templates/blog/. You can use your regular blog list template for instance:


    If you are only searching blog posts, you probably can simply things by using perch_blog_custom() instead of perch_content_search() to perform the search:


    Hi,


    I think this is related to your other search thread in which you use perch_content_search() to perform the search and use perch_blog_custom() to render the blog results within the search. In this case perch_blog_custom() does not control the order, perch_content_search() does.

    If you're following the same approach, yYou need to use the skip-template and return-html options. I don't know how well supported they are in the Events app (it is an old app):


    PHP
    1. $result = perch_events_custom(array(
    2. 'filter' => 'eventSlug',
    3. 'match' => 'eq',
    4. 'value' => perch_get('s'),
    5. 'template' => 'listing/event-detail.html',
    6. 'skip-template' => true,
    7. 'return-html' => true,
    8. ));

    Eg give them an area/page of the site they could manage colours, so they can add new ones. Then on a separate page allow them to choose the colours from checkboxes?

    Perhaps categories is a good option. You create the categories via the control panel, then you can add a category field to wherever you want the editor to select them from (page attributes, regions, etc):


    HTML
    1. <perch:categories id="colours" set="colours" label="Colours" display-as="checkboxes"></perch:categories>


    You can add more fields to your category templates, so the suggestions made in the previous comments may still be relevant to your use case.

    But that file just contains an opening (but no closing) PHP statement.

    While I expect you get a warning because $_SERVER['SERVER_NAME'] is not set in this context, a closing PHP tag is optional at the end of a file.



    Anyway, there is more than one way to handle this. You can rely on Perch production modes instead of $_SERVER['SERVER_NAME']:



    And config/env.php can just define the production mode. The value should be set according to the environment, so locally you'd have this:


    PHP
    1. define('PERCH_PRODUCTION_MODE', PERCH_DEVELOPMENT);


    And on your production server you'd have this:

    PHP
    1. define('PERCH_PRODUCTION_MODE', PERCH_PRODUCTION);



    Alternatively, you can look into environment variables.

    Do you need a separate region for the form? If you are not adding any editable content to the form template, you don't need a new region; instead you can add the form to your job_detail.html template (where you already have access to the job title):


    HTML
    1. <perch:input type="hidden" id="jobFormTitle" label="Job Title" value="<perch:content id="jobTitle">" />


    If you need a region, then you can the skip templating when fetching the job, get the title and pass it as a variable: