This question has been answered by multiple community members. See the first response.
Are you looking at the actual output of the makeURL function, or are you looking at the final link's URL in a web browser? Your base tag in your page head will automatically add the leading part of the URL.I'm looking at the actual output of the makeUrl() function, written to log with
As you're running the plugin from the 'mgr' context, did you specify 'web' in the $context parameter?Interesting hint. Tried that a few seconds ago.
You could also try $modx->switchContext('web') just before your makeUrl() call (not sure if that will work). Switch back to 'mgr' afterwards.Thanks a lot, it's working!
I think I remember cross-context urls always being forced to absolute scheme.
Quote from: okyanet at Nov 23, 2012, 12:56 PMYou could also try $modx->switchContext('web') just before your makeUrl() call (not sure if that will work). Switch back to 'mgr' afterwards.Thanks a lot, it's working!
I think I remember cross-context urls always being forced to absolute scheme.
$context = $modx->context->key; // results in "mgr"
$modx->switchContext('web');
$context = $modx->context->key; // results in "web"
$url = $modx->makeUrl($resource->get('id')); // url path is relative now! Yeah!
$modx->switchContext('mgr');
$context = $modx->context->key; // results back to "mgr"
Great!
$url = $modx->makeUrl($resource->get('id'), "", "", "full");