【发布时间】:2012-02-24 19:09:21
【问题描述】:
我刚开始使用drupal,如果这是一个非常愚蠢的问题,我深表歉意。我编写了以下模块,但每次尝试访问它时,转到 url (http://localhost:8888/drupal/doodil_viral_signup) 我都会收到拒绝访问消息。我已经尝试重建权限并禁用和重新启用模块,但它似乎不起作用。
<?php
// $Id$
/**
* @file
* A module to encourage users to sign up.
* This module allows users to sign up to register for the site, and invite their friends to do the same.
*/
/**
* Implements hook_help().
*/
function doodil_viral_signup_help($path, $arg) {
if ($path == 'admin/help#first') {
return t('This module allows users to sign up to register for the site, and invite their friends to do the same.');
}
}
/**
* Implements hook_menu().
*/
function doodil_viral_signup_menu($may_cache = true) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'doodil_viral_signup',
'title' => t('Doodil Signup'),
'callback' => 'doodil_viral_signup_page',
'access' => TRUE,
'type' => MENU_CALLBACK,
);
}
return $items;
}
function doodil_viral_signup_page() {
return drupal_get_form('doodil_viral_signup_page_form');
}
function doodil_viral_signup_page_form() {
// [input text] First Name
$form['first_name'] = array(
'#type' => 'textfield',
'#title' => t('First Name'),
);
// [input text] Last Name
$form['last_name'] = array(
'#type' => 'textfield',
'#title' => t('Last Name'),
);
// [input text] Email Address
$form['email_address'] = array(
'#type' => 'textfield',
'#title' => t('Email Address'),
);
// [input submit] Sign Me Up
$form['submit'] = array(
'#type' => 'submit',
'#title' => t('Sign Me Up'),
);
return $form;
}
function doodil_viral_signup_page_form_submit($form_id, $form_values) {
$message = 'You have submitted the following information <pre>'.print_r($form_values).'</pre>';
drupal_set_message(t($message));
}
谁能告诉我如何解决这个问题?
提前致谢!
【问题讨论】:
标签: php drupal drupal-7 drupal-modules