I’m wondering if there is a way to find the ID of a resource based solely on the uri passed?
For example, my internal search engine is picking up pages that are temporarily linked to other pages by means of the Weblink Resource Type. So Resource A, is showing up in my search results with a description of Resource B’s uri. Whereas Resource A’s content is [[~22]].
What I was considering was using FastField to pull the content of Resource B in for the description of Resource A. Is this possible to even do? This is what I had so far:
In my chunk:
[[+resource_type:contains=`modweblink`:then=` <div class="result"> <div class="pagetitle"><a href="[[+uri]]">[[+pagetitle]] (the weblink)</a></div> <div class="content">[[+content:ContentID]]</div> </div> `:else=` <div class="result"> <div class="pagetitle"><a href="[[+uri]]">[[+pagetitle]]</a></div> <div class="content">[[+content:prepareContent]]</div> </div> `]]
In the ContentID snippet (currently is only displaying the rendered uri):
<?php $resourceID = $modx->findResource($input); return $resourceID;
I was hoping that I could return the ID (22) from the $input to then put into a FastField of [[#[[+content:ContentID]].content]]. Or is this way overthinking it?
Thanks in advance!