i just developed my own module let's say "test" and i want this module to select all users that i have on drupal and display it on my page say "page1" so,i created test.module that contains:
test.module
**********
<?
function test_menu()
{
$items[]=array();
$items[]=array(
'path' =>'node/10', // "this is the page that i want to display result on it"
'title'=>t("this is test module"),
'description'=> t("Here is the test module"),
'page callback'=>'drupal_get_form',
'page arguments'=>'test_settings',
'access'=>user_access('access administration page'),
'type'=>MENU_CALLBACK,);
return $items;
}
function test_settings()
{
drupal_set_message(t("hello test module"));
}
?>
and test.install
************
function test_install()
{
$q=db_query("select * from users");
while($arr=db_fetch_array($q))
{
| <? echo $row[0];?> | <? echo $row[1];?> |
Comments
Drupal 5 vs Drupal 6 API
Your hook_menu follows Drupal 5 specification yet you are developing for Drupal 6.
so,could u tell me what i can
so,could u tell me what i can do..?
Have a look at
Have a look at http://api.drupal.org/api/function/page_example_menu/6, in particular the hook_menu implementation.
No Change
have the same problem ....i can't get the test module under menu items and nothing happened new :S:S
any help.....
Can you please provide more
Can you please provide more information? What exactly did you do? What did you expect? What happened? What did you try? Show us your code...
See http://drupal.org/node/19279 for useful tip on reporting bugs.
i just developed my own
i just developed my own module let's say "test" and i want this module to select all users that i have on drupal and display it on my page say "page1" so,i created test.module that contains:
test.module
**********
<?
function test_menu()
{
$items[]=array();
$items[]=array(
'path' =>'node/10', // "this is the page that i want to display result on it"
'title'=>t("this is test module"),
'description'=> t("Here is the test module"),
'page callback'=>'drupal_get_form',
'page arguments'=>'test_settings',
'access'=>user_access('access administration page'),
'type'=>MENU_CALLBACK,);
return $items;
}
function test_settings()
{
drupal_set_message(t("hello test module"));
}
?>
and test.install
************
<?
foreach($arr as $value)
{
?>
<? echo $row[0];?>
<? echo $row[1];?>
<?
}
}
}
function test_uninstall()
{
print "No data is available";
}
?>
and test.info
**********
name = test
description = Enables keeping easily and regularly updated user web pages or blogs.
version = VERSION
core = 6.x
; Information added by drupal.org packaging script on 2009-05-13
version = "6.12"
project = "drupal"
datestamp = "1242243950"
then ,i can see the test module and check that i want to enable it but,when i go to menu section i canot find it and i didnot find the list of users in page that i spacify..........so what is the expected problem..?
thanks for ur time
Go through the below
Go through the below link.
Module Creation
BTW do you know for what we use .install file???
When posting code, please
When posting code, please wrap it it <code>...</code>.
Your problem is the hook_module
I don't know if you read the documentation already, but the problem of your code is that the hook_menu in Drupal 6 (i.e. the test_menu function) should not be constructed the way you did it. Follow the documentation links at the other comments and your code will work. :)