Posts by davedesigner

    ...I added $today_date = date('Y-m-d'); and...


    Code
    1. perch_content_custom('Events', array(
    2. 'page'=> '/events.php',
    3. 'template' => '_event_listing_feed.html',
    4. 'filter' => 'enddate',
    5. 'match'=>'gte',
    6. 'value'=> $today_date,
    7. 'sort' => 'startdate',
    8. 'sort-order' => 'ASC',
    9. 'count'=> 9,
    10. ));

    Seemed to fix this.

    I've a got the list of events like so...


    Code
    1. perch_content_custom('Events', array(
    2. 'page'=> '/events.php',
    3. 'template' => '_event_listing_feed.html',
    4. 'sort' => 'startdate',
    5. 'sort-order' => 'ASC',
    6. 'count'=> 9,
    7. ));


    However I want to hide any event older than today's date.


    How do I filter the events to only that are only greater than or equal to today's date?

    Thanks for confirming Drew.


    This would explain some editors getting in a pickle on sites with listing where an image is the key content. Editors (especially beginners) leap in to create content before they've gathered the relevant material like the key image!


    I generally would create a fallback image for these sites but of course there's no feedback in the Editor that this is happening.


    There is a case where stopping publishing where an image is required would help.

    I'm using Perch: 3.1.5, PHP: 7.1.30,


    When setting an image with required="true" I've notice that the image field ignores the "required" status and saves with no image. Is this a bug?


    Code
    1. <img src="<perch:content type="image" id="image" label="Image" width="800" required="true">

    Thanks it sort of works as the comparison can be made in the 'Products' region.


    However the Image banner being `suppress="true"` in the in the detail template is being drawn and published to another place on the page using...


    Code
    1. if (perch_get('p')) {
    2. perch_content_custom('Products', array(
    3. 'page' => '/product_page.php',
    4. 'template' => '_page_banner_image.html',
    5. 'filter' => 'slug',
    6. 'match' => 'eq',
    7. 'value' => perch_get('p'),
    8. 'count' => 1,
    9. ));

    ...and the 'default_banner' ID is not turning up in the _page_banner_image.html template.


    How to I get 'default_banner' in that template?

    Thanks. I think I've got this correct and the default banner field is now available in the 'Products' region.


    However when I use...


    Code
    1. perch_content_custom('Products', [
    2. 'data' => [
    3. 'default_banner' => perch_content('Banner', true),
    4. ],
    5. ]);

    This as it stands outputs the detail page as a full list and not getting a single item on say page (product_page.php?p=my-page)


    How do I sort 'Products' on a single slug query?

    Could you not manage the default banner with another region?

    The default image banner template is in another region. It's used in the list page (product_page.php) and the other template is using detail_template_with_banner.html in the (product_page.php?p=every_other_page).


    Is there a way of getting a field from a region in (product_page.php) into a region in (product_page.php?p=every_other_page) to do a compare with perch:if in a template?


    I thought they had to be in the same runtime?


    Or should the default banner template be in a shared region to make it available?

    Wondering if there's a way of achieving the following...


    I have a list and detail page where the user can upload a banner image to override a default banner image (set for the whole list) that I've uploaded to a resources folder outside of Perch CMS (for those cases when an image is not available when adding a new item to the list).


    Which is easily achieved in a template...


    Code
    1. <perch:if exists="bannerimage">
    2. <div class="static-banner" style="background-image: url(<perch:content id="bannerimage" type="image" width="1400" height="200" crop="true" help="Add a full width banner image with a minimmum with of 1400px" />);">
    3. <perch:else>
    4. <div class="static-banner" style="background-image: url(../default-static-banner.jpg)">
    5. </perch:if>
    6. </div>

    However is there a way of the user changing the default banner themselves within Perch?


    Currently the default banner image has to appear on the list page as the default banner image but would also show on a single item detail page when nothing has been uploaded to override it.

    I have a list and detail page sorted by 7 categories. Fine all that works. :thumbup:


    I've extended this so that each category name has an css class added to give a unique colour in the category list by editing a category template and adding <perch:category id="colour" />. Fine all that works. :thumbup:


    The problem is I need to display the active category with it's colour/class inside the perch template on other items used in the detail.php page when it's selected.


    Can anyone point me in the right direction to do this?