Forum
perch:related and slugs
Hi
I'm working with perch:related
for the first time and I've run into a problem - hoping it's just something I've done wrong...
This is my perch:related
template
<perch:related id="relateddevelopmentName" collection="property developments" label="Development name">
<perch:content id="developmentName" title="true" label="Development name" />
</perch:related>
This works in the Admin CMS, it lists all the perch:content with a id="developmentName"
I can also output this to the page.
BUT, the slug isn't being generated?
Here's the template for the id="developmentName"
used in another part of the website:
<perch:content id="developmentName" divider-before="Development information" type="text" label="Name of development" html="false" title="true" />
<perch:content id="slug" for="developmentName" type="slug" suppress="true" />
I've tried adding the id="slug"
to the perch:related
template - but it doesn't have any effect.
<perch:related id="relateddevelopmentName" collection="property developments" label="Development name">
<perch:content id="developmentName" title="true" label="Development name" />
<perch:content id="slug" for="developmentName" type="slug" suppress="true" />
</perch:related>
I've used <perch:showall />
to list all the available IDs
but slug
isn't listed. But it is listed where I'm using the id="developmentName"
elsewhere on the website...
Hope you can help.
- Perch Runway 2.8.13
- PHP 5.6.10 is up to date
- MySQL 5.5.42 is up to date
- Image processing available
I've very confused about that you're trying to do.
When you add an item to the
property developments
collection, does the slug get generated?I'm not sure how slug generation factors into the relationship.
Hi Drew
Yes. The
slug
is being generated fromid="developmentName"
in the property developments collection.I'm using
perch:related
in a different collection, pulling inid="developmentName"
.This bit works, a list of
id="developmentName"
is displayed in the CMS and I can output the selection to the page.The problem is with the
slug
. I need it as I'm usingslug
as part of my navigation.I'll create a simplified demo (might help me get to the bottom of it) or at lease make it easier to explain :)
You have
suppress="true"
set.Hi Drew
Thanks, yes
suppress="true"
was set, that was stopping theslug
from displaying, I also realised that everythingrelated
needs to be within theperch:related
tag pair.I have noticed something though:
When I use a regular
perch:content
withtitle="true"
theitem
name in the CMS updates.But when I used
perch:related
theitem
name in the CMS isn't updated. Even thoughtitle="true"
is used. It's worth mentioningperch:related
is pulling in content fromcollection="property developments"
and a slug is being generated.The main issue here is with the
item
in the CMS not updating to displaytitle="true"
. This means all my items in thecollection
that usesperch:related
look like this:Is there something I'm missing (again)? :)
It's a different scope. You can't use fields from a related item to name the current item. The title needs to come from the item itself.
No worries, thanks for the reply! :)
Hello Drew,
Is a slug based on fields from a related item something that you are planning to add? It would be very convenient.
I've tried using a composite input, but it doesn't seem to work with related content either.
Am I missing something?