Page 1 of 1

File path in JavaScript Plugin

PostPosted: Fri Dec 16, 2016 4:43 pm
by charal3
Hi everyone,

I am doing a plugin in JavaScript, and i've been stuck.
I would like to make an image appears in front (like a simple button), but I have a problem with the file loaded.

I get the file path thanks to a filechooser in .xml like this :
Code: Select all
<filechooser id="file" name="tr:File" default="" filters="images,flash" allowRemote="true"/>

And then I retrieve it in a .tmpl file :
Code: Select all
<option name="file" value="{{ p.file.fileName }}" type="string" />

Finally, now I am writting the behavior in JavaScript, and I don't know how to transform this (which is in Django) :
Code: Select all
url="%FIRSTXML%/{{pluginDirectory}}/{{plugin.file.fileName}}"

Into JavaScript, something like this :
Code: Select all
var file = getKrValue("ptplugin["+pPlugID+"].settings[0].option[file].value", "string");
jQuery(button).css('url-background', file);

I need to get the value of %FIRSTXML% and {{pluginDirectory}}, to get the full path of my file (I believe).

If anyone could help me, it'd be great !
Thank you all.

Re: File path in JavaScript Plugin

PostPosted: Mon Dec 19, 2016 11:48 pm
by 360-compunics-com-ni
Do you have 'settings'-elements defined in your plugin?
If not, the call to retrieve the value might be:
Code: Select all
var file = getKrValue("ptplugin["+pPlugID+"].option[file].value", "string");