Forum
Runway: Creating an entry page for collection items?
I'm trying to create an article page when clicked on from an archive of articles (collections).
Using the following will display all articles, but I only want to show the relevant article that is selected from the archive view.
<?php
perch_collection('Knowledge Articles', [
'template' => 'cpi/knowledge_article.html',
?>
It occurred to me that I should be using the slug to achieve this - I looked in the documentation to see how this is done elsewhere and found (how to create a detail page)[https://solutions.grabaperch.com/architecture/how-do-i-create-list-detail-pages] This however doesn't work but is there something similar that I should be doing?
<?php
perch_collection('Knowledge Articles', [
'template' => 'cpi/knowledge_article.html',
'filter' => 'slug',
'match' => 'eq',
value' => perch_get('s'),
'count' =>1
]);
?>
Both look fine once you fix the syntax errors.
and
It might be a good idea to turn PHP's error display on in your dev environment - it'll help you catch typos.
Looks like the syntax is ok in my code - it might have been me copying and pasting it wrong. I'm still having the same problem - nothing is showing on the article page once I add the filter, match and value settings to the function.
What's the value of
s
in your route?So I'm assuming
s
stands for "slug" for the article? In essence I'm replicating the structure of the Blog App with Runway with it's post template and assigning it to a page. For the Article Page I'm doing the following with it's Route.The Route: "knowledge-base/[slug:cat]/[slug:s]"
So the URL structure would be: knowledge-base/category-name/article-name
I'm capturing the slug for the articles using the following in it's template.
<perch:content id="titleSlug" type="slug" for="title" label="Slug" editable="true" order="2" suppress="true" />
You should be using the id of titleSlug on your filter
As that's the id that you're using in your template
Thanks Dexter!
That seemed to do the job.
I'm having the same problem like Dan and I just can't manage to work things out.
Basically, I have a home page that displays latest post with this code
The data is captured via wallpaper.html template
I have a list and detail page. Here is the code for the list page
And this is the code that shows all wallpapers
I just can’t manage to show one item selected from list to display on detail page.
Here is the detail page code
Also, the route URL pattern for this page is
What am I doing wrong?
You're asking perch to get
mirko
but it doesn't know where from.Your route needs to be
wallpapers/[slug:mirko]
Updated but nothing is showing up...... :( Here is a debug message
Ahh plus, you're filtering on an id called
slug
of which doesn't exist. It's got the ID ofmirko
.You need to change filter from
slug
tomirko
Ok, I should write it like this?
Sorry no,
Are you on perch or perch runway?
SOLVED!!!! It works!!!!!! :D Thanks Dexter!!!!!!!!!!!
Runway!