pullRelated from a URLMapContent Detail Page

9 views
Skip to first unread message

h3wy

unread,
Mar 10, 2021, 1:54:19 PM3/10/21
to dotCMS User Group
Hello,

We would like the ability to set a relationship field in a detail page that our users can select content that is related to that speciifc page. I'm having trouble pulling the related field because it is a URLMapContent page (we have successfully done this with other content types using the code below).

Does anyone know how this is done?

Thanks!

Code we have used to make this work before on none URLMapContent pages
<div class="row">
#set($cardList = $dotcontent.pullRelated("EdgeAcademyDetail.relatedProducts","$!{ContentIdentifier}",false,0))
#foreach($card in $cardList)

<ul><li>$card.title</li></ul>

#end
</div>




Mark Pitely

unread,
Mar 10, 2021, 3:31:40 PM3/10/21
to dot...@googlegroups.com
$URLMapContent contains the structure detail that sent you to the page, so $URLMapContent.relatedProducts here)
You can also reuse your code if you do something like:
#set ($EdgeAcademyDetail=$URLMapContent) at the start of the page and it should then 'act' exactly the same way.

Mark Pitely
Marywood University

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/84c98f44-348f-4840-8e79-e615c04c689cn%40googlegroups.com.

Andrew Hewitt

unread,
Mar 11, 2021, 8:11:36 AM3/11/21
to dot...@googlegroups.com
Thanks Mark! We got this to work. I always appreciate your help with dotCMS

Reply all
Reply to author
Forward
0 new messages