跳转到主要内容
learningxm 提交于 6 December 2012

inc文件是可以调用的php文件.

用来定义函数

inc文件的用法:

1、导入的方法module_load_include();

<?php // Load node.admin.inc from the node module. module_load_include('inc', 'node', 'node.admin'); // Load content_types.inc from the node module. module_load_include('inc', 'node', 'content_types'); ?>

2、菜单调用的方法

learningxm 提交于 5 December 2012
<?php <? function module_name_form() { $form = array(); $form['city'] = array( '#title' => t('City'), '#type' => 'textfield', '#autocomplete_path' => 'example/autocomplete',//--调用的路径 ); $form['submit'] = array( '#type' => 'submit', '#value' => 'Save', ); return $form; } //--定义路径 function module_name_menu() { $items['example/autocomplete'] = array( 'page callback' => '_module_name_autocomplete', //--调用数据 'access arguments' => array('access example autocomplete'), 'type' => MENU_CALLBACK ); return $i
learningxm 提交于 5 December 2012
<?php $items['contact'] = array( 'title' => 'Contact', 'page callback' => 'drupal_get_form', 'page arguments' => array('contact_site_form'), 'access arguments' => array('access site-wide contact form'), 'type' => MENU_SUGGESTED_ITEM, //--建议类型的菜单,可以开启 'file' => 'contact.pages.inc', 'file path'=>drupal_get_path('module','contact'),//--在其他模块里面调用的时候添加路径 ); ?>
订阅