Drupal 是一個CMS, 它除了有很多 PHP 的函數 可以調用之外,
還有在頁面的 javascript 加了一些常用的變數, 函數
你可以在 firebug 或者 chrome 的 developer console內,
用 Drupal.* 找到它們
例如 PHP 函數<?php base_path()?> 可以在 Drupal.settings.basePath 內找到
所以 AJAX 的要求路徑便可以隨網站路徑自動改變了
Drupal 是一個CMS, 它除了有很多 PHP 的函數 可以調用之外,
還有在頁面的 javascript 加了一些常用的變數, 函數
你可以在 firebug 或者 chrome 的 developer console內,
用 Drupal.* 找到它們
例如 PHP 函數<?php base_path()?> 可以在 Drupal.settings.basePath 內找到
所以 AJAX 的要求路徑便可以隨網站路徑自動改變了
如題, 你可以在 theme 的 .info file 用以下的方法
scripts[] = js/gallery.js
stylesheets[all][] = css/gallery.css<script type="text/javascript" src=""></script>你可能會考慮用以上的方法include 了
Note1: 路徑是相對到theme 的資料夾
Node2: 它們會被優化的, 如果你開啟了壓縮 js/css 檔案的話
As titled, if you want to add a js or css file only to a theme, you may:
scripts[] = js/gallery.js
stylesheets[all][] = css/gallery.cssThis should contain mostly contain some 3rd party js/css libraries/frameworks.
if you find you put some <script type="text/javascript" src=""></script> in page.tpl.php, you better think again to put it like above.
Note1: the path they refered is CURRENT_THEME directory
Node2: They will got aggregated if you turn on compressing js/css files in "Performance" page