Drupal add js (functie)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

De functie

drupal_add_js($data = NULL, $options = NULL)

voegt een JavaScript-bestand, -instelling of -script toe aan een pagina. Dit artikel is beperkt tot deze laatste functie, bv. om Google-tags in te voegen in een pagina. $options is een array: $options['type']: 'file', 'inline', 'external' of 'setting' → Ik gebruik 'inline'

Voorbeeld:

drupal_add_js('alert("Hello, world!")','inline')