I am trying to figure out what the main difference is between mymodule.module
and mymodule.admin.inc
.
Can anybody explain it?
Without going into the ins and outs, Drupal understands the .module file as being a module within the system. The .inc notation has always been used in PHP for 'include' files. When developing modules you might want to split functionality into different .inc files.
Modules being used in specific cases use conventions similar to .admin.inc. That file typically includes all the code necessary to run the administrative interface, and a file node.pages.inc for example contains the code executed for other menu callbacks.
Adding on to the answer given by Alex Gill
hook_menu()
, or by making an explicit using module_load_include('inc', 'node', 'node.admin').In short, mymodule.module is the php file that drupal automagically loads when that module is enabled. It can then include other files when needed. Usually, mymodule.admin.inc is included to create its admin settings menu. If you grep through mymodule.module, you can see where. Sometimes when a module gets pretty complex, it is broken up into smaller files and they are then included as well.
Difference between module file and inc file
For example hook_node_load, hook_form_alter need to be in .module file.