Module development howto's

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Locked
vinyl
Forum Members
Forum Members
Posts: 149
Joined: Mon Jul 13, 2009 8:18 pm

Module development howto's

Post by vinyl »

Are there any good up-to-date module development howto's out there?

I found this one (in Dutch, which I am) but that is missing the part about how to create the admin panel:

http://wiki.cmsms.nl/index.php/User_Han ... utorial/nl

I have an idea for a module, know how to write PHP code, but I don't have any experience with making a module for CMSMS.

Any tips?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Module development howto's

Post by calguy1000 »

There are a minimum 2 steps to creating an admin interface.

1. make sure the HasAdmin() method in the module class returns TRUE.

Code: Select all

public function HasAdmin() { return TRUE; }
- if it was previously set to return FALSE then you will need to bump the version number of the module.

2. Override the VisibleToAdminUser() method to determine WHO the module is visible to.

Code: Select all

public function VisibleToAdminUser() { 
   return $this->CheckPermission('Modify Site Preferences'); 
}
3. Begin filling in the 'defaultadmin' action. Typically this is in the action.defaultadmin.php

Code: Select all

<?php
if( !isset($gCms) ) exit;
echo __FILE__;
?>
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Module development howto's

Post by calguy1000 »

The API's work identically in the frontend to the backend. with the following exceptions:
a: There is no concept of a returnid or 'page' in the admin interface.
so the returnid passed to actions is always the same
b: There is no concept of inline vs. non inline in the admin interface.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Locked

Return to “Developers Discussion”