Jump to content

Example module.inc file

From NusaATK
Revision as of 06:23, 13 July 2006 by bahtiar (talk | contribs) (CompleteModuleFile moved to Example module.inc file)

Every module you add to an ATK application follows some basic principles.

Create a directory, where the name is equal to the module name. For example, if you're going to create a module 'users', name the directory 'users'. It's best to place it in the modules/ subdir of your application.

In the directory, you place your node files. A module does not necessarily have to have any nodes, but most modules will consist of one or more nodes.

The module file is the most important part of the directory, as it will define the module. This file should be called 'module.inc' and should contain the following code:

<?php

  class mod_users extends atkModule
  {

     function getNodes()
     {
        registerNode("users.group", array("admin", "add", "edit", "delete"));
     }

     function getMenuItems()
     {
        $this->menuitem("groupadmin", dispatch_url("users.group", "admin"));
     }

  }

?>