Drupal 6:定义特定页面的js和css [英] Drupal 6: defining js and css for particular pages
问题描述
我是一个drupal新手...
I'm a drupal newbie...
当我在 filename.info 文件中定义css和js时,所有页面。我有一些特定的css-js文件的一些特定的网页,我不想通过导入所有这些文件的网站实际上不需要这些文件,通过减少网站。
When I define css and js at filename.info file, it takes effects for all pages. I have some particular css-js files for some particular pages, and I don't wanna slow site down by importing all these files for the pages actually no need these files.
如何定义特定页面的js和css?
How can I define js and css for particular pages?
欣赏有助于!非常感谢。
Appreciate helps!!! thanks a lot!!!
推荐答案
Drupal API 提供了两个功能 drupal_add_css
和 drupal_add_js
The Drupal API offers two functions drupal_add_css
and drupal_add_js
that you can use.
有一个getcha,如果你在fx中使用这些 preprocess_page
函数,其中 $ script
和 $ styles
变量已经创建,它与, drupal_get_css
或 drupal_get_js
There's a gotcha, if you use these in fx the preprocess_page
function where the $script
and $styles
variable already has been created, you need to overwrite it with, drupal_get_css
or drupal_get_js
这篇关于Drupal 6:定义特定页面的js和css的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!