Drupal function basic usage
I was learning drupal and found like using
drupal_add_js(
array('philquotes' =>
array("json_url" => $json_url)), 'setting');
and he says that it get converted to
Drupal.settings.philquotes.json_url
a开发者_如何学编程nd this is used to pass php variable to JS. I got a doubt that is it just used to create a JS variable in PHP so that it can be accessible in JS or any other meaning is there in it ?
drupal_add_js
function can be used to add a setting, but can also be used to add a file or inline javascript. Drupal has some good documentation in its API. See the drupal_add_js
documentation at http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_add_js/7
精彩评论