For the form to be listed in the control panel you have to submit at least one response. Does the form get listed after you submit a response?
Creating the form template for this is fine, but would this require a custom app to send the data to the collection?
Correct. In your form template you would add your app ID in the app attribute:
Your form handler function would go in your app's runtime file perch/addons/apps/gary_app_id/runtime.php:
Apologies, I didn't really grasp the need for using the collection import API.
The Collections import API provides a way to interact with a Collection's items. Inside the form handler of your app you have access to data submitted by a user. This data is not saved in the database. It is your responsibility here to handle the data as you need. In this case you want to add the data to a Collection item. The import API is a documented and supported way to do that.
No that is not required for existing pages with existing regions. perch_content_create() creates a content region if it doesn't already exist. If the region already exists, you don't have to create it.
You can edit the URLs in your templates. Find the template(s) that is outputting the links, and change the URLs to what you need them to be.
You can keep using Perch Members for user authentication, but you may have to manage the profiles outside of it. Even if you write a custom form handler to handle the file uploads, there's no public API for locating and updating Members.
One option is to use a Runway Collection for the profiles and link each member to a Collection item. You'd need to write a custom form handler and use the collection import API to locate and update the Collection items. If you are dealing with images, you can also import them as Perch Assets or perhaps upload them straight to something like Cloudinary and only record the image URL in Perch.
How are you outputting your regions at the moment? Are you using perch_content() or perch_content_custom()?
Happy to help!
Your post_search_result.html template is like any other blog template. You need to use the perch:blog name space and you need to use the actual blog post fields. You are no longer in the context of the search there.
So you would use:
You should be able to use action="/".
...but the results show like this (with blank spots where the post_search_result.html elements should be). Seems like the layout is not pulling in the right data.
You are outputting <li> twice per a single search result item. Once from inside search-result.html and again from inside post_search_result.html.
What is the 'post_search_result.html' page supposed to look like? Just like the search-result.html?
It should be used to output the search results of a single blog post.
I'm limiting the search to /community (which we call our Blog) so all results all blog-only (which we want). But the results are showing in the regular layout from the search-result.html template. With some testing, I see it's pulling in the post_search_result.php layout, but it's stopping there.
If you want to limit the search results to the Blog app, you would use the apps option:
Using Perch Runway 2.8.29 ......does that mean I need ending slashes somewhere?
Yes. Your template tags need to be self-closing />.
My comment included the path for each template ^^!
The function perch_content_search() uses the template templates/search/search-result.html by default. I'll assume you are using that.
With the search-result.html template you output the HTML for regular search results. However, when the search result source is the Blog app you use a Perch Layout include to output the search result item. Perch Layouts are PHP files. So the following:
Includes the PHP file templates/layouts/blog_search_result.php. Inside this file you use the function perch_blog_custom() to output the blog search result. This function renders another HTML template. The template you render with this function has to be placed in the directory templates/blog/ like all your other Blog app templates.
In other words, if it's a regular search result:
perch_content_search() -> templates/search/search-result.html
If the search result source is the Blog app:
perch_content_search() -> templates/search/search-result.html -> templates/layouts/blog_search_result.php (which uses perch_blog_custom()) -> templates/blog/post_search_result.html
Where to I put the show all tag? I've tried a few spots, but I don't see anything.
You would add it to your search results template.
If you really need to make all the Blog post fields available in search result, there are workarounds. I'll go over one:
Add conditional tags to separate the search results based on the source:HTML
Add a Perch Layout include and pass the result URL as a Layout variable:
Create /perch/templates/layouts/blog_search_result.php and filter the posts using the result URL:
Create the template /perch/templates/blog/post_search_result.html and include any Blog post field you want.
I don't think it's available in this context. If you can't see it when use perch:showall, it's not there. The Blog app search handler is what determines what fields are made available in the blog search results.
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?
These two are technically the same page. Anyway, if you want to get a region from another page, perch_content_custom() has a page option which allows you to do this.
I thought they had to be in the same runtime?
perch_content() outputs the region as evaluated and rendered when saved in the control panel. perch_content_custom() outputs the region as evaluated and rendered at run time (when the page is visited).
You have 2 regions, (A) a banner (B) a list of products. To make something from (A) available in (B), (B) has to be output with perch_content_custom().
Assuming (A) only contains the banner with the same HTML you need:
perch_content('Banner', true) gets you the rendered template (HTML included). Below the default_banner outputs the HTML too:HTML
- <perch:if exists="bannerimage">
- <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" />);">
- <perch:content id="default_banner" type="hidden" html>
If you only need to grab a field value, you'll have to use perch_content_custom() and the skip-template option to grab the field in PHP.