Drupal 7 将 jQuery 文件添加到所有页面

Drupal 7 Add jQuery File to all pages

本文关键字:添加 jQuery 文件 Drupal      更新时间:2023-09-26

我已经在这里查看了drupal的主页:https://drupal.org/node/171213,但仍然收到错误。

在我的 .info 文件中,我添加了代码:

stylesheets[all][] = template.css
scripts[] = megamenu.js

我知道不需要样式表。我只是把它放在那里,以参考它在我的代码中的外观。

我检查了我的Google Chrome Web-Dev设置,它甚至没有加载.js页面,这让我相信我在.info文件中做错了什么。有人对我哪里出错有任何想法吗?

谢谢!

根据我上面的评论,清除主题缓存可以解决问题。

$form['#attached']['js'] = array(drupal_get_path('module', 'billing') .'/billing.js' => array( "类型" => "文件", ));