By superjose on
Hi guys. Before flaming me, I have read on how to use drupal_add_js function, but up until know it hasn't worked for me, and I don't want to put it specifically on the theme, but on a desired page.
I've tried using the src, like this:
script type="text/javascript" src="sites/files/includes/engine/verify.js"
OR
script type="text/javascript" src="/sites/files/includes/engine/verify.js"
I do use included PHP and it works fine... Can't request via HTTP because my server blocks it...
So, can anyone suggest me a way on doing so? Thanks :p.
Comments
If you have a custom module I
If you have a custom module I would still advice to use drupal_add_js if it's only used on a few pages.
You could use a hook (like hook_init) to add your .JS file with conditions of the current page.
Something like:
Using custom 'script' tags is not the Drupal way to do it. Using drupal_add_js is, especially combined with a module so you can add it throughout the process.
Hmmm. Never thought of
Hmmm. Never thought of that!.
Hehe, I am not using any personal modules (yet :p), but thanks for telling me that "SRCing" the Javascript file won't be possible, and for giving me the idea of conditioning the page so it can add the .js whenever I wanted. Thanks :p.
No problem, hope it gives you
No problem, hope it gives you some direction :)
If you have any more questions when building is, let me know!
Oh, and SRCing is possible within your theme .tpl files but not recommended (if you ask me) at all.