A basic call might look something like this:
{$base_url}manager/media/browser/mcpuk/browser.html?Type=images&Connector={$base_url}manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath={$base_url}
You would code it to where $base_url would be the full URL. You could of course use the $site_url variable as well...but I prefer a full URL with a domain name just to be safe. Now, the resource browser expects some parameters. Here they are in detail:
Type: There are four basic directory paths where the manager stores images and files. The value of ’Type’ reflects this. The four values are ’images’, ’files’, ’media’, and ’flash’.
Connector: This must be equal to the full path to the proper connector.php file.
ServerPath: This must be equal to the relative path to the root of your site.
The resulting URL might look something like this:
http://www.myserver.com/manager/media/browser/mcpuk/browser.html?Type=images&Connector=/manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=/
Use this URL to create a javascript pop-up. Once the resource browser is opened and an image or file is selected, the browser will attempt to run a javascript function from within the parent window where the browser was called. This function must be named SetUrl and have one parameter for the full URL of the resource. This will allow you to set the value of an element to the full URL of the selected resource from the resource browser. Such a function might look like this (taken from the TinyMCE plugin):
function SetUrl( url )
{
var formObj = document.forms[0];
formObj.elements[curFormField].value = url ;
if (formObj.width.value && formObj.height.value){
resetImageData();
}
showPreviewImage(document.forms[0].elements[curFormField].value);
}
It’s pretty straight-forward once you’ve done it. One of the things we’re hoping to do soon is replace the current resource browser with something else that has a better API with more hooks and better features.
Jeff