This seems a daft question but I cannot seem to get multiple pages to work. What I am trying to achieve is create a single module that has four distinct parts to it

- list users in the database
- add a user to the database
- edit a user in the database
- delete a user

In normal HTML/JScript/PHP I would have distinct pages for doing each of these tasks. I have used the module reference example and got the first function to work. Now I want to create a separate page to add a user and use the form submit to write back to the database just like I would with any other web page running PHP.

Every attempt I have made to get a separate page to display fails. So does this mean that I have to create 4 modules (mymodule_list, mymodule_add, mymodule_edit and mymodule_delete) or is it possible for a module to have more then one page?

Comments

jaypan’s picture

You can have as many pages as you want in one module. You just register a path for each page you want to create. You can register paths with wildcards as well, so they can theoretically have an unlimited number of pages.

Contact me to contract me for D7 -> D10/11 migrations.

da_solver’s picture

Hi,
The base (core) Drupal installation includes a user (management) module. The documentation pages are located here:
http://api.drupal.org/api/drupal/modules!user!user.module/7
http://api.drupal.org/api/drupal/modules!user!user.pages.inc/7
http://api.drupal.org/api/drupal/modules!user!user.admin.inc/7

On each of those pages there is a link to "View Source". Just click on the link for further details.

The source includes all sorts of great detailed explanations.

Good Luck :)
Hope that helps.

nevets’s picture

You do realize that add/edit/delete user are all in core and you can do the listing with views

ismith78’s picture

Thanks to Jaypan for confirming that you could do multiple pages with Drupal, and to da_solver for the links.

I now have two pages running one for adding to my database and one for reading back out. Fixed by combination of going back and starting from clean and understanding that the default permissions for pages seem to be not to display the menu links for anyone including the administrator. That is until you go into the permissions page for the module. I'm guessing that is probably down to something I'm not returning correctly in the _permissions() function.