lists at hikarinet.info
Mon Feb 8 19:23:32 UTC 2010
I've needed that once too :)
Let's say you add your script:
First of all, you should avoid running your script just during the page load, because if you do so you'll make the page load slowly.
Use the 'onload' event or add it to the footer ('wp_print_footer_scripts' action).
script needs it, so if your script runs after or just after the page load, I believe you can use the 'wp_print_scripts' action to
add the variable to the header. Just change the previous function to include it.
var prefix_path = <?php echo plugin_dir_url(__FILE__); ?>;
I didn't test the code, but it's an exemple. This way, your script can try for 'prefix_path', and if the code is right it will store
the URL path to your plugin's root folder, and using it you can append subfolders and files, having access to what you want.
I've already used a proprietary dropdown menu that its JS considered it would be always used in homepage, and when it run inside
posts and other resources its images were being deleted, because they weren't where the script was expecting :P
Hikari - A Luz ilumina a PAZ
Tenha seu próprio email meunome @ ConscienciaPlanetaria.com.br!: http://seunome.ConscienciaPlanetaria.com.br
More information about the wp-hackers