所有,我有一个新模块开发的问题。作为一个菜鸟,我需要你的帮助。
Info file
; $Id$
name="cities"
description="List of cities"
core=7.x
Module file
<?php
// $Id$
/**
*impliments hook_menu()
*/
/**
* @file
* cities module
.
*/
function cities_menu()
{
$items=array();
$items['cities']=array(
'title' => 'Cities listed',
'page callbacks' => 'cities_page',
'access arguments'=>array('view content')
);
return $items;
}
/**
*Build a from containing :
*(1)Space to input volume
*(2)A Submit ("Convert") button.
*/
function cities_form($form,&$form_state){
$form['cities']=array(
'#type'=>'select',
'#title' => t('cities'),
'#size'=>5,
'#default_value' => array('City list' => 'City list'),
'#options' => array('Kolkata' => 'Kolkata', 'Mumbai' => 'Mumbai','Cnennai' => 'Cnennai', 'Srilanka' => 'Srilanka','Delhi' => 'Delhi', 'Siliguri' => 'Siliguri'),
'#description'=>t('The number of Cities listed here'),
);
$form['submit']=array(
'#type'=>'submit',
'#value'=>t('Get Val'),
);
return $form;
}
function cities_page($form,&$form_state)
{
return cities_form('cities_form');
}
function cities_form_submit($form,&$form_state)
{
$output=(
$from_state['values']['default_value']);
set_drupal_message($output);
}
?>
. 除了这些,我在控制台中找不到任何错误信息。
But when I typed mysitename/cities
in address bar it redirects me on localhost
请帮我运行我的代码。
谢谢。