Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Drupal';s.info文件没有';无法加载多个js文件_Javascript_Drupal - Fatal编程技术网

Javascript Drupal';s.info文件没有';无法加载多个js文件

Javascript Drupal';s.info文件没有';无法加载多个js文件,javascript,drupal,Javascript,Drupal,尽管我按照建议在Drupal7的.info文件中包含了多个.js文件,但只有第一个文件可以加载到 脚本[]=js/jquery.cycle2.min.js 但不是更进一步。更改顺序没有帮助,似乎每次在第一个循环js文件时都停止加载。 我错过了什么?或者,出于某种原因/设置,是否只可能包含max 3.js core = 7.x engine = phptemplate stylesheets[all][] = style.css stylesheets[all][] = media.css scr

尽管我按照建议在Drupal7的.info文件中包含了多个.js文件,但只有第一个文件可以加载到 脚本[]=js/jquery.cycle2.min.js 但不是更进一步。更改顺序没有帮助,似乎每次在第一个循环js文件时都停止加载。 我错过了什么?或者,出于某种原因/设置,是否只可能包含max 3.js

core = 7.x
engine = phptemplate
stylesheets[all][] = style.css
stylesheets[all][] = media.css
scripts[] = js/custom.js
scripts[] = js/jquery.cycle2.min.js
scripts[] = js/jquery.cycle2.caption2.min.js
scripts[] = js/jquery.js

尝试另一种包含js文件的方法。 /您的主题/template.php

    function mytheme_preprocess_page(&$vars, $hook) {
        drupal_add_js(drupal_get_path('theme', 'mytheme') . 'js/custom.js');
        drupal_add_js(drupal_get_path('theme', 'mytheme') . 'js/jquery.cycle2.min.js');
        drupal_add_js(drupal_get_path('theme', 'mytheme') . 'js/jquery.cycle2.caption2.min.js');
        drupal_add_js(drupal_get_path('theme', 'mytheme') . 'js/jquery.js');
        $vars['scripts'] = drupal_get_js(); 
      }

谢谢。

您可以使用以下功能在站点上添加JS:

function mytheme_preprocess_page(&$vars, $hook) {
  if (true) {
    drupal_add_js(drupal_get_path('theme', 'mytheme') . '/mytheme.js');
    drupal_add_js(drupal_get_path('theme', 'mytheme') . '/mytheme1.js');
    $vars['scripts'] = drupal_get_js(); // necessary in D7?
  }
}
如果(true){???请将您的条件放在需要应用此部分的位置。