Reputation: 90
I have made a declaration like this in php (taken from WordPress path url in js script file):
<script type="text/javascript">
var templateurl = "<?php bloginfo('template_url') ?>";
</script>
then i have this code in my javascript (myjava.js):
init : function(ed, url) {
ed.addCommand('mcearrow_shortcodes', function() {
ed.windowManager.open({
file : url + '/interface.php',
width : 410 + ed.getLang('arrow_shortcodes.delta_width', 0),
height : 250 + ed.getLang('arrow_shortcodes.delta_height', 0),
inline : 1
}, {
plugin_url : url
});
});
ed.addButton('arrow_shortcodes', {
title : 'arrow_shortcodes.desc',
cmd : 'mcearrow_shortcodes',
image : url + '/btn.png'
});
ed.onNodeChange.add(function(ed, cm, n) {
cm.setActive('arrow_shortcodes', n.nodeName == 'IMG');
});
},
I want to change all the 'url +' with templateurl, I've tried to use this:
file : templateurl + '/includes/scripts/interface.php'
But it doesn't work. It doesn't load the interface.php. However, if I use 'url +', the interface.php is loaded perfectly. Problem is, I want to put my interface.php in different folder. Not in the same folder where myjava.js is located.
What's the correct way to use my templateurl variable?
Many thanks!
Upvotes: 0
Views: 2850
Reputation: 3877
Do the templateurl has the value? Please check it. You are assigning php variable so please echo it.
<script type="text/javascript">
var templateurl = "<?php echo bloginfo('template_url') ?>";
</script>
Upvotes: 2