Posts by hus_hmd

    That could be helpful as this seems to be a recurring issue for a number of people (based on what I see here on the forum and on the Perchology slack group). While the template core concepts does cover namespacing, I can see namespaces being added to the top of relevant pages as tags which would act as a quick reminder to the reader:



    But that's not my call to make. The docs are open source now and has a public GitHub repository (https://github.com/PerchCMS/perch-docs). So opening an issue on there would be the ideal place to discuss this with drewm

    Hi drewm


    It seems PerchAPI_SubmittedForm::validate() does not handle arrays at the moment. So an input like this always throw an error (given the required attribute is set):


    HTML
    1. <perch:input id="email[primary]" type="text" label="First Name" required>


    I can workaround this by using an alternative syntax (e.g. email__primary) and writing a little more PHP if I really wanted to have it as an array. However, I can't avoid using arrays for handling multiple file uploads:


    HTML
    1. <perch:input type="file" id="uploads[]" multiple accept="pdf">


    It would be very helpful if PerchAPI_SubmittedForm can validate values submitted as arrays.

    Line 6 in post.php is responsible for outputting the meta data:


    PHP
    1. <?php perch_blog_post_meta(perch_get('s')); ?>


    The function renders the template blog/meta_head.html. The default template uses the postTitle field for <title>:


    HTML
    1. <title><perch:blog id="postTitle" /></title>


    You can add custom fields to your post template blog/post.html. If you want your custom fields to appear in the Meta and Social tab, add them to the post meta template blog/post_meta.html. Then you can update your meta_head.html template to use your custom fields.

    • Are you using the sample post.php that comes with Perch Blog app? Or have you written your own?
    • What do you mean by title tag? The <title> tag in <head>?

    The template you specify in perch_content_custom() is used to render the template at run time. The template your specify in perch_content_create() is used in the edit form in the control panel.


    Create the region "My Region" if it doesn't already exist:

    PHP
    1. perch_content_create('My Region', [
    2. 'template' => 'some_template.html'
    3. ]);


    Output the cached rendered template for the region "My Region":

    PHP
    1. perch_content('My Region');


    If you only use perch_content() without creating the region first, Perch is smart enough to create it for you instead of penalising you for not explicitly creating the region first. In this case you would need to edit the region settings (including choosing the region template) via the control panel.



    that should enable me to achieve the results I'm after?

    I'm not 100% sure I understand what you are after. If you want to specify the edit form template for new regions, use perch_content_create() to create the region as demonstrated above.

    Do you face this issue when uploading any image or just larger images? As JordinB mentioned, it is possible that you are trying to upload a file that is larger than what's configured for PHP on your server. To check your configuration via Perch, go to Settings > Diagnostics > Extended (tab) and look for "PHP max upload size" under "Hosting settings". You can also check your server error logs to confirm whether this is in fact the issue.

    Hi Brett,

    • Is the problem present on your staging and development environments too?
    • Have you checked your server error logs?
    • Has your host made any changes to your server?
    • What version of Perch and PHP are you using?

    As stated in the docs, you need to use an array. However, you are passing a string.

    PHP
    1. // this is an array
    2. $array = ['/section/page-01.php', '/section/page-02.php', '/section/page-03.php'];
    3. // this is a string
    4. $string = "'/section/page-01.php', '/section/page-02.php', '/section/page-03.php'";


    You don't need to use a template for this. Given that you are not dealing with sub-pages, you can use something like this:



    Now you should be able to use 'page' => $paths, in your perch_content_custom() call. No brackets needed around $paths.

    If you want to keep using Perch navigation functions, you can create a page with a different URL and set it to redirect to the URL you want. This way you avoid the conflict. You can have an editable region in your master page to edit the URL you want to redirect to:


    PHP
    1. $url = perch_content('URL', true);
    2. PerchUtil::redirect($url);


    Another option would be to create a shared region and let the editor manually manage the links.

    So.... Is there a way to get Perch (Runway) to use an ID generated in each as part of filter/value?

    No, it is not.

    • Any additional IDs you add to the item in this context is not in the database so Perch can't use it in its database queries
    • The each callback function is executed after Perch queries the database


    How are you determining what the upcoming date is? Is it stored in a date field?

    Another developer reported a similar issue when reordering products and there is an issue open on GitHub. I'm yet to address this and I'm unsure when I would, but I'll release a small update with additional user privileges for reordering and republishing products so you can at least disable the option for the editors.


    p.s. I shouldn't provide support for this on here. Please use GitHub issues if you need to report any issues or suggest a feature.