adding new module problem
when i added a new(my owm) module it was ok and i tried to make it appeares in menu :
quotes.module
***********
function quotes_menu()
{
$items[]=array();
$items[]=array(
'path' =>'admin/settings/favorite/quotes',
'title' =>t("Manage favorite quotes"),
'description' => t("Add more favorite quotes"),
'callback' => 'drupal_get_form',
'callback arguments' => 'quotes_settings',
'access' => user_access('access administration pages')
);
return $items;
}
function quotes_settings()
{
$form["quotes_manage"]=array(
'$type'=>'fieldset',
'$title'=>t("Add New Quote"),
'$tree'=>TRUE
);
$form["quotes_manage"]["add"][0]=array(
'$type'=>'textfield',
'$title'=>t("Enter a Quote"),
'$description'=>t("Qualified quotes are only those are your favorite")
);
$form["quotes_manage"]["add"][1]=array(
'$type'=>'textfield',
'$title'=>t("Auther")
);
$form["$submit"] = array("quotes_get_form"=>array());
return system_settings_form($form);
}
function quotes_get_form($form_id,$form_values)
{
drupal_set_message(t("Submitted OK"));
}
but when i click on "Manage favorite quotes " it doesnot refresh to the page that contains the 2 text boxes and so on....so what is the expected problem??????????

*_*
hook_menu() re-written for 6.x
function quotes_menu()
{
$items[]=array();
$items['admin/settings/favorite/quotes']=array(
'title' =>t("Manage favorite quotes"),
'description' => t("Add more favorite quotes"),
'page callback' => 'drupal_get_form',
'page arguments' => 'quotes_settings',
'access callback' => user_access('access administration pages')
);
return $items;
}
Regards.
:)
Beautifulmind
do u mean that , i write
do u mean that , i write function hook_menu() instead of quotes_menu() ?
if the answer is yes,...i do that but the problem is still existing
*_*
Nop, hook is a general term
for this matter it will be quotes_menu(), but you have to define the menus in Drupal 6.x way.
:)
Beautifulmind
ok,but how i can define the
ok,but how i can define the menus in drupal 6.x ???
*_*
Check the very first reply. Also, look at http://api.drupal.org and type in 'hook_menu'
:)
Beautifulmind
thanks for advance but, i
thanks for advance
but, i follow up what it is recommended but there is the same problem :(
well, could i know the
well,
could i know the meaning of this line:
function quotes_menu()
{
.....
.....
'path' =>'admin/settings/favorite/quotes',
.....
....
}
Location in admin menu
It basically specified the location of the title of your module in the admin menu. In your case, your menu title will appear under admin->settings->favourite->quotes->"Manage favorite quotes"
In the updated api,
$items[]=array();$items['admin/settings/favorite/quotes'] //This is used instead of "path"
This is incorrect. It should
This is incorrect.
It should be...
<?phpfunction quotes_menu() {
$items = array();
$items['admin/settings/quotes'] = array( // favorite/quotes probably won't be accessible from site configuration menu if favorite doesn't exist
'title' => 'Manage favorite quotes',
'description' => 'Add more favorite quotes',
'page callback' => 'drupal_get_form',
'page arguments' => array('quotes_settings'), // notice the array() here
'access callback' => 'user_access', // not a function call
'access arguments' => array('administer site configuration'), // these are your access arguments for user_access
'type' => MENU_NORMAL_ITEM
);
return $items;
}
?>
but when i click the"Manage
but when i click the"Manage favorite Quotes" link it is supposed to load a page that contains 2 textboxs by calling the function quotes_settings() ,but that is didnot happen??????
function quotes_settings()
{
$form["quotes_manage"]=array(
'$type'=>'fieldset',
'$title'=>t("Add New Quote"),
'$tree'=>TRUE
);
$form["quotes_manage"]["add"][0]=array(
'$type'=>'textfield',
'$title'=>t("Enter a Quote"),
'$description'=>t("Qualified quotes are only those are your favorite")
);
$form["quotes_manage"]["add"][1]=array(
'$type'=>'textfield',
$title'=>t("Auther")
);
$form["$submit"] = array("quotes_get_form"=>array());
return system_settings_form($form);
}
function quotes_get_form($form_id,$form_values)
{
drupal_set_message(t("Submitted OK"));
}
so plzz tell me what is the problem on that...........
thanks in advance
*_*
Read the hand book for how to create forms.
The code for the form you've written doesn't seem like a Drupal form
:)
Beautifulmind