[development] php and js in a programmatic block

Fred Jones fredthejonester at gmail.com
Sun Nov 28 15:45:20 UTC 2010


> 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.

See http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_add_js/6
in particular:

Add inline JavaScript code ('inline'): Executes a piece of JavaScript
code on the current page by placing the code directly in the page.
This can, for example, be useful to tell the user that a new message
arrived, by opening a pop up, alert box etc.


More information about the development mailing list