[development] php and js in a programmatic block

jeff at ayendesigns.com jeff at ayendesigns.com
Sun Nov 28 15:43:03 UTC 2010

Nothing confuses me faster than mixing php and js (and especially 
escaping the quotes). In this case, my confusion is the concept and not 
the gobblygook.

I have a module invoking hook_block, and a function that creates and 
returns the block content. In this function I invoke drupal_add_js to 
gather the contents of ./mymodule.js

So far so good. However, the js needs to be dynamic...there are two 
function values that need to be embedded in it. I'm thinking that with 
this being the case, drupal_add_js might not be the way to go (back to 
escaping quotes), but wanted to poll first for best practice, since I'll 
be contributing this module.



More information about the development mailing list