<![CDATA[ [Collections] How to get pagetitle from the id on the collections view ? - My Forums]]> https://forums.modx.com/thread/?thread=103853 <![CDATA[ [Collections] How to get pagetitle from the id on the collections view ?]]> https://forums.modx.com/thread/103853/collections-how-to-get-pagetitle-from-the-id-on-the-collections-view#dis-post-558566 I have a Collections view with a resource's ID column.
I want to render those IDs with their respective pagetitle.
So I create a snippet called getPagetitleFromID which I call from the Snippet columns view parameter.

But I don't know how to make this snippet code.
I read a little bit xPDO docs but I was a little bit affraid !!!

For now, I have just wrote this but it doesn't work :
$value = $modx->resource->getOne('value');
return $value->get('pagetitle');


Is anyone can help me ?]]>
Spheerys May 14, 2018, 08:35 PM https://forums.modx.com/thread/103853/collections-how-to-get-pagetitle-from-the-id-on-the-collections-view#dis-post-558566
<![CDATA[Re: [Collections] How to get pagetitle from the id on the collections view ?]]> https://forums.modx.com/thread/103853/collections-how-to-get-pagetitle-from-the-id-on-the-collections-view#dis-post-561321
<?php
$resourceID = $modx->getOption('value', $scriptProperties, '');
$resource = $modx->getObject('modResource', $resourceID);
$output = $resource->get('pagetitle');
return $output;
]]>
bwente Sep 02, 2018, 07:24 PM https://forums.modx.com/thread/103853/collections-how-to-get-pagetitle-from-the-id-on-the-collections-view#dis-post-561321
<![CDATA[Re: [Collections] How to get pagetitle from the id on the collections view ?]]> https://forums.modx.com/thread/103853/collections-how-to-get-pagetitle-from-the-id-on-the-collections-view#dis-post-558622
See the Columns section here: https://docs.modx.com/extras/revo/collections]]>
BobRay May 17, 2018, 10:08 PM https://forums.modx.com/thread/103853/collections-how-to-get-pagetitle-from-the-id-on-the-collections-view#dis-post-558622
<![CDATA[Re: [Collections] How to get pagetitle from the id on the collections view ?]]> https://forums.modx.com/thread/103853/collections-how-to-get-pagetitle-from-the-id-on-the-collections-view#dis-post-558611
Here my Collection view :

You can see on the second column a number : it's the ID to a resource retreived from a list of Categories.
I want to get the categorie's pagetitle instead of the ID

On the collection column settings , I can set a snippet to render the result :



So I create a snippet called getPagetitleFromID because it's look the best way to get what I want.
But I have difficulties to write the code of this snippet !]]>
Spheerys May 17, 2018, 09:37 AM https://forums.modx.com/thread/103853/collections-how-to-get-pagetitle-from-the-id-on-the-collections-view#dis-post-558611
<![CDATA[Re: [Collections] How to get pagetitle from the id on the collections view ?]]> https://forums.modx.com/thread/103853/collections-how-to-get-pagetitle-from-the-id-on-the-collections-view#dis-post-558602 ]]> BobRay May 16, 2018, 08:39 PM https://forums.modx.com/thread/103853/collections-how-to-get-pagetitle-from-the-id-on-the-collections-view#dis-post-558602 <![CDATA[Re: [Collections] How to get pagetitle from the id on the collections view ?]]> https://forums.modx.com/thread/103853/collections-how-to-get-pagetitle-from-the-id-on-the-collections-view#dis-post-558594 Quote from: BobRay at May 15, 2018, 03:56 AM
Is there a Tpl for the display?
No, I don't have template !
Just a snippet code with php.

If that doesn't work, how are you sending the ID to your snippet?
That's the point !
On this blog post about Collections, there is an interesting section about "Image and other Custom Renderers"
But I not very competent with JS nor Php, so I'm a little bit lost...]]>
Spheerys May 16, 2018, 01:09 PM https://forums.modx.com/thread/103853/collections-how-to-get-pagetitle-from-the-id-on-the-collections-view#dis-post-558594
<![CDATA[Re: [Collections] How to get pagetitle from the id on the collections view ?]]> https://forums.modx.com/thread/103853/collections-how-to-get-pagetitle-from-the-id-on-the-collections-view#dis-post-558569
[[+pagetitle]]


If that doesn't work, how are you sending the ID to your snippet?


]]>
BobRay May 15, 2018, 03:56 AM https://forums.modx.com/thread/103853/collections-how-to-get-pagetitle-from-the-id-on-the-collections-view#dis-post-558569