How to associate *.js.php files to Javascript? |
|
Hello.
I don't think you can do that. The file asociations are mostly based on file extension, which is the string fragment after the LAST dot - that way an extension may be an empty string if there is no dot in the file name. This also means, that if you have file named 'myscript.js.php', then the file name is 'myscript.js' and the extension is 'php'. The '*.php' expression for file associations is just a common way, how to say "everything with 'php' extension". This is different from searching for "*.js.php" string, where the search engine is mostly based on regular expressions and understands, that you want to search "everything ending with '.js.php'". So unless you have a regular expression based file association, the '*.js.php' file association will not work, because simply put the extension 'js.php' can never exist. |
||||||||||||
|
|
O.K, so what can I do?
I have JavaScript files which has inner PHP code, but in order that the server will process those files using the PHP engine it must ends with ".php". One way I can get the associated syntax colors is every time when I code some JS in such files, I can rename it to pure *.js extension, but this is very annoying - renaming it every time I want to edit those files. Any other solution? hack? patch? trick? |
||||||||||||
|
|
If you just need to parse PHP code in JS files inside phpEd, there is an option for this in Tools -> Settings -> Code Insight -> Settings -> Parse PHP in JS files - check that option and that should do the trick.
But if you need the web server (like Apache) to parse PHP code inside JS files, you either need to change the server configuration to treat '.js' extension as PHP files or you can use '.htaccess' and mod_rewrite (for Apache servers). The second option is preferable, this way the JS file will not really exist, but the rewrite engine will redirect the file request to PHP script, which would create the JS file on the fly. You would need to google information elsewhere though, because this has nothing to do with phpEd (try google "mod_rewrite" and "htaccess" for details). |
||||||||||||
|
How to associate *.js.php files to Javascript? |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by