Posts by Stephen Meehan

    hus_hmd thanks, ideally some sort of focus based cropping should be part of Perch core. The imgix service isn't expensive, and I really like the work you've done to make this work with Perch, however it's one more cost for something that I feel isn't unreasonable to be part of Perch.

    Hi


    Just spotted this on a client website...




    It'd be so useful to be able to click on a focal point in an image and set that as the crop, instead of the default 'crop from the middle'.


    Many other Content Management Systems have this feature:

    1. [Umbraco](https://our.umbraco.org/docume…e-cropper#set-focal-point)
    2. [CraftCMS](https://github.com/smcyr/Craft-FocusPoint)
    3. [Squarespace.com](https://support.squarespace.co…l-points-to-center-images)
    4. [Wix.com](https://support.wix.com/en/art…o-in-the-wix-pro-gallery#)
    5. [Silverstripe](https://www.silverstripe.org/b…ropping-for-silverstripe/
    6. [Sitecore](https://inverseproportion.word…ocus-cropper-in-sitecore/)

    The links above come from this GitHub [post](https://github.com/processwire…swire-requests/issues/150).



    Can we expect image cropping options in Perch 4?

    I can see in the docs, we can use id="count.blog.post" to output category count tags.


    Is there a way to do a category count with a collection?


    I'm trying to achieve this:

    • Cars (12)
    • Boats (9)
    • Planes (3)

    Cars, Boats and Planes are categories assigned to a collection. The numbers indicate the number of posts in each category.


    Can I do this with categories & collections? Or is a category count only available when using categories & Blog App?

    Hi,


    The Blog App allows me to display the number of posts associated with a category.


    I can list all the categories and display a number next to each category title. Like this:

    • Cars (12)
    • Boats (9)
    • Planes (3)

    Is there a way to do this with a 'Collection'? I'm considering using a 'Collection' instead of the Blog App

    Hi,


    The template setup below works, until I try to use rescope="parent"


    Code
    1. <perch:blocks>
    2. <perch:block type="Image" label="Image">
    3. <perch:template path="path/to/template.html">
    4. </perch:block>
    5. </perch:blocks>


    template.html also includes a perch:template



    When I add rescope="parent" , the nested perch:template doesn't work properly...


    Code
    1. <perch:blocks>
    2. <perch:block type="Image" label="Image">
    3. <perch:template path="path/to/template.html" rescope="parent">
    4. </perch:block>
    5. </perch:blocks>


    • In this example the template.html is an image
    • The template fields appear in the CMS, but when I press save, there's no output?
    • When I look in the source, I can see the template HTML is being output, but it's missing the image path


    Perch Runway: 3.1.3

    To use _block_id inside a perch:repeater, just do this:


    Add scope-parent to the perch:repeater, then add id="parent._block_id" to the ID inside the perch:repeater

    Code
    1. <perch:repeater scope-parent id="your_repeater_id"><perch:content id="parent._block_id" type="hidden">-item-<perch:content id="perch_item_index" type="hidden"></perch:repeater>


    When combined with perch_item_index, this will output a unique value per item inside a repeater. A useful addition if you intend to have more than one block on a page.



    More info in the docs, at the bottom of the page, 'Accessing content outside the repeater'.

    I've hit a bump with this...


    When I have more than one block on a page, the value of perch_item_index is no longer unique.


    Using perch:showall I can see each block as a unique ID


    <perch:content id="_block_id">


    I was hoping to combine _block_id and perch_item_index to make a unique value within a repeater


    Unfortunately, I can't access _block_id inside a repeater


    I've created variables from IDs in the past, but the way I do that involved referencing a fixed page. As this is a block, it could appear anywhere.


    Is it possible to make _block_id a variable, so I could use it inside a repeater


    Or perhaps there's a better way to create a unique value per item in a repeater ?

    Hi,


    I'm using a repeater in my template.


    I'd like to be able to output a unique CSS class for each item in a repeater, something like this:


    Code
    1. <div class="item-0">...</div>
    2. <div class="item-1">...</div>
    3. <div class="item-2">...</div>


    I've used <perch:showall> and I can see each repeater item starts with a unique array, simplified example below.


    Is it possible to use these array numbers in my HTML template? If not, perhaps I could use the [assetID]?




    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

    Figured it out.


    Found this post


    I was looking at the debug on the page, not in the control panel (!).


    I had this error in Perch control panel:


    Code
    1. { "error": { "errors": [ { "domain": "usageLimits", "reason": "ipRefererBlocked", "message": "The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions.", "extendedHelp": "https://console.developers.google.com/apis/credentials?project=xxxxxxxxxxxx" } ], "code": 403, "message": "The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions." } }


    Within Google API settings 'Application restrictions', I had restricted the API key to a specific domain - I must have set it up wrong. When I (temporarily) remove it and press save, the YouTube Fieldtype works a charm.


    I'll leave it there for now. At least I know the issue is related to 'Application restrictions' in Google API settings ad has nothing to do with the YouTube Fieldtype.


    Thanks for the support!

    Hi,


    YouTube embeds are working using the YouTube Fieldtype


    I've setup my YouTube API key, and checked Debug (no errors).


    Code
    1. <!--* output="embed" - Displays video on page *-->
    2. <perch:content width="560" height="315" id="video" type="youtube" label="YouTube URL" output="embed">


    However, I've been unable to get any other output types to work?

    Code
    1. <!--* None of these are working? *-->
    2. <perch:content id="video" type="youtube" output="title" />
    3. <perch:content id="video" type="youtube" output="description" />
    4. <perch:content id="video" type="youtube" output="date" />


    Screenshot below shows <perch:showall>

    Screenshot-2019-04-10-20-21-43.png


    The three URLs in the screenshot above show the output of output="title", output="description" and output="date"


    Is there anything else can try?



    Perch information

    Came up with a solution...


    I created a couple of variables, one to check the current category. And another so I could use id="cd_form", from a category template in my blog template.


    I'll post it here next week.



    Thanks for the replies ryan, have a great weekend.

    Hi


    At the moment I've hardcoded the control-and-display category, this will be a variable


    I would have thought  'category' => 'news/control-and-display/' would have done the trick - but it looks like it's being ignored as perch_blog_custom  is still displaying id="cd_form" from other categories?



    The original code works, in the sense that it displays id="cd_form". The problem is when a post is associated with more than one category. When that happens id="cd_form" is output more than once. Does that make sense?:/