柳暗花明笔记

    drupal hook_init() 可真是一个好函数

    所属分类:[ php&web ] 猫哲学家 发表于:2012-08-10 21:58 浏览:429

    drupal hook_init() 可真是一个好函数,可以在所有页面请求前做一些初始化工作。

    Perform setup tasks. See also, hook_boot.

    This hook is run at the beginning of the page request. It is typically used to set up global parameters which are needed later in the request. when this hook is called, all modules are already loaded in memory.

    This hook is not run on cached pages.

    To add CSS or JS that should be present on all pages, modules should not implement this hook, but declare these files in their .info file.
    Related topics

    Hooks
    Allow modules to interact with the Drupal core.

    function hook_init() {   // Since this file should only be loaded on the front page, it cannot be   // declared in the info file.   if (drupal_is_front_page()) {     drupal_add_css(drupal_get_path('module', 'foo') . '/foo.css');   } }
    标签: drupal 
    上一编文章 曾经写的分页 下一编文章 php 判断手机访问以及手机的类别
    最近文章
    发表评论