I'm trying to get the _page hook to work with a module I've built. In the docs, it says, "_page(): If a module requires its own page it should provide a function named module_page. The page can then be publicly accessed via http://yourdomain.com/module.php?mod=module which will cause the engine to invoke module_page in order to generate the module's page."

(1) First problem I'm having is that there is no module.php ... What should this be?

(2) 2nd, in two places it says either create a function called module_page or a function called name_of_my_module_page ... Which do I create? module_page() or name_of_my_module_page()

Thx,

Gerry Lawrence

Comments

ax’s picture

(1) in 4.2, module.php?mod=module changed to just <module_name> (clean urls enabled) or ?q=<module_name> (clean urls disabled), eg. module.php?mod=book became book (clean urls enabled) or ?q=book (clean urls disabled)

(2) if your module is called gerry.module, your hooks are named gerry_<hook>() - the page() hook would be gerry_page().

(2), by the way, is documented quite clearly at http://drupal.org/node/view/329 . i'm just updating the book page to fix (1).

Anonymous’s picture

Thanks again ax. I was just looking at the book page ... Re. prior posts, when I'm done with the project, I will send on "patch" or whatnot re. use of classes as modules ... or maybe better yet to submit as some sort of 'node' for the Development section?

Also, I saw you did not like the core idea ... Obviously, one throws their custom modules into a sub-dir of the /modules dir. Re. your comments, I'm guessing the idea is to hold the number of modules in the /modules dir to its current number? Also it sounded like there would be more involved for this change than just vetting the code base for all the references to the /modules path? Or would it be that easy?

I also ran into this last night. I created two custom blocks and had some common function names in each. Drupal doesn't allow one to use the same function name in different blocks? Is this right?

Thanks again, Drupal is very, very nice,

Gerry Lawrence

moshe weitzman’s picture

I like the idea of segregating the core modules into a /core subdirectory. This is an easy change in CVS, and doesn't require us to rewrite the INSTALL intructions for every Contributed module. Not a big deal either way, though.