I need to set the path and root path for the image manager based on various scenarios.
Same user may use the image manager to upload images from different pages. I want to send a parameter from the client side to indicated the scenario. For example, if the user is using the editor in home page, send home; similarly, if using in contact us page send contact. All I can do is set the root path on client side during init. For example, imagemanager_rootpath: “test”. But my path is computed on server side based on the parameter I send. Is there any way to do this.
From what I understand of your issue, you have two options:
1: Generate the Javascript from a template on the server (Say using Smarty or equivalent) and insert the correct root path into the TinyMCE init code.
So, in straight PHP, you might end up with something like this:
2: Generate a Javascript parameter file that contains all the parameters you want the Javascript to have, then use this when initialising the tinyMCE instance.
Parameter file:
HTML:
Javascript:
Hope that helps!