2014-03-19 43 views
0

我试图实现我的自定义模型来调用js和css..but它没有表现出任何的结果hook_preprocess_page ...hook_preprocess_page不drupal7自定义模块工作

 module: 

    <?php 

    function wizardify_preprocess_page(&$variables) { 
    // define base path for our module 
    $base = drupal_get_path('module', 'wizardify'); 
    // add the wizardifying javascripts 
    drupal_add_js($base . '/js/formToWizard.js'); 
    drupal_add_js($base . '/js/jquery.wizardify.init.js'); 
    // add the custom css 
    drupal_add_css($base .'/css/wizardify.css'); 
    } 

     js file: 

    jQuery(document).ready(function() { 
    // wizardify the webform 
    jQuery("#webform_client_form_8").formToWizard({ submitButton: "edit-submit" }); 
    // add the 'button' class to the next and previous links 
    jQuery('a.prev').addClass('button'); 
    jQuery('a.next').addClass('button'); 
     }); 

回答

0

function template_preprocess_page是钩你必须把你的template.php文件。

找到你的template.php在您的活动主题,把你的预处理功能,像你这样:

function YOUR_THEME_NAME_preprocess_page(&$variables) { 

    // define base path for our module 
    $base = drupal_get_path('module', 'wizardify'); 

    // add the wizardifying javascripts 
    drupal_add_js($base . '/js/formToWizard.js'); 
    drupal_add_js($base . '/js/jquery.wizardify.init.js'); 

    // add the custom css 
    drupal_add_css($base .'/css/wizardify.css'); 
} 

,它应该工作,我刚试过。