Quote from: Jayster at Dec 07, 2010, 12:08 PM
is there a Modx API function call that returns a resource id, if you pass it a URL to a resource?
I’m sure Modx must do this internally, in order to display resources.
Well, it’s a bit more complex than that, and at the moment there is not an API function for this, but you can look it up within a specific context by using something like this, assuming friendly URLs are being used:
<?php
$uri = 'path/to/resource/';
$resourceId = 0;
if (array_key_exists($uri, $modx->aliasMap)) {
$resourceId = $modx->aliasMap[$uri];
}
// etc., etc.
?>
Across contexts would get more complex, as you would first need to determine the context.
Maybe if you provide a use case I can provide more specific guidance.