Drupal → Как подключить внешний js или css файл
Drupal 7:
// В любом месте drupal_add_js('http://example.com/scripts.js', array('type' => 'external')); drupal_add_css('http://example.com/style.css', array('type' => 'external')); // В рендер-массиве $form['#attached']['js'][] = array('data' => 'http://example.com/scripts.js', 'type' => 'external'); $form['#attached']['css'][] = array('data' => 'http://example.com/style.css', 'type' => 'external');
Drupal 6:
drupal_set_html_head('<script type="text/javascript" src="http://example.com/scripts.js"></script>'); drupal_set_html_head('<link type="text/css" rel="stylesheet" href="http://example.com/style.css" />');
Оставить комментарий