I need to init some js variable by passing php variable to <some javascript>.js
file, in my php project under Eclipe Luna IDE (PDT)
When I'm trying to do:
if (typeof strPreviewImg == 'undefined') {
strPreviewImg = <?php echo(plugin_dir_url( __FILE__ )."images/vpreview_center.png"); ?>;
}
I've got following errors from Eclipse:
Multiple markers at this line - Syntax error, insert ": Expression" to complete Expression - Syntax error on token "<", invalid Expression - Syntax error on tokens, delete these tokens
When I'm trying to use quotes:
if (typeof strPreviewImg == 'undefined') {
strPreviewImg = "<?php echo(plugin_dir_url( __FILE__ ).\"images/vpreview_center.png\"); ?>";
}
Whole php expression is passed as string to my HTML code:
<video poster="<?php echo(plugin_dir_url( __FILE__ ).'images/vpreview_center.png)'; ?>">
So, am I doing something wrong or there's some Eclipse PDT issue?
Thanks