-
- 119 Posts
Bit backwards I know, but I need to get the resource alias when all I'll know is its pagetitle - is there any way to do this currently or would I need to create a new query to handle it?
Cheers!
You would need to query it..do you need the alias or the URI which represents the Resource uniquely?
-
- 119 Posts
Just the alias would do - I know where in the tree the resources would be
Just keep in mind, the alias may or may not be part of the URI for accessing the Resource. Not sure what you are doing with the alias, but knowing where it is in the tree will not help reconstruct the URI except in very limited cases.
-
- 119 Posts
And thanks for your help as ever!
-
- 24,544 Posts
If there's any way you can use the Resource ID, that will be a lot more reliable, since pagetitles can change (and be misspelled) but the ID never changes. If you know the ID (in parentheses in the tree), all you need is this:
<?php
$resource = $modx->getObject('modResource', $id);
$alias = $resource->get('alias');
-
- 119 Posts
I wish I could Bob! The site is integrating the Eventbrite API and using the page title of event venues to match up with the venue names in Eventbrite, so we can show upcoming events within the site. The client will be lectured extensively about not changing the page titles!