Programming your own module

Almost every customer has at least one special request which is not feasible with HTML. Then offer a solution with PHP. Unlike other systems, you must not pay attention too much in Webutler when programming an extension.

Include

An extension is simply loaded via include in a page. Thus, the extension is a part of the page and all paths of enlargement must be adjusted accordingly (modules/__MODULEDIRECTORY__/...).

Links and GET parameters

A Webutler page is called with index.php?page=__PAGENAME__. This means that all the links on your extension must also index.php?page=__PAGENAME__ begin. You can set other parameters with &var=value. Who uses the SEO URLs and requires more than 7 GET variables can be used in the globalvars.php the variable $webutler_config['urlgetvars'] enhance and complement the RewriteRules in the root htaccess.

Module Search plugin

A separate module can be integrated into the Webutler search function. This, the file search.php must exist and in search.php the searchinmodcontent_ __MODULEDIRECTORY__ function. The function must provide an array of title, content and URL back. Example:

$result = array('title' => 'page title',
'contents' => 'Page content with keyword',
'url' => 'index.php?page=__PAGENAME__&var=value');
return $result;

Thus the Webutler search also find the module must be entered in the file /settings/searching.php there.

Modul Sitemap

Include your own module in the sitemap works in the same way as the integration into the search. The file sitemap.php must exist in module directory and in the file the function modulessitemap__MODULEDIRECTORY__. The function must provide an array containing the URLs of the module:

$result = array(
[0] => 'index.php?page=__PAGENAME__&var1=value1',
[1] => 'index.php?page=__PAGENAME__&var1=value2',
[2] => 'index.php?page=__PAGENAME__&var1=value3&var2=value1'
);
return $result;

In addition, the module must be entered in the file /settings/sitemaps.php.

Header data

Javascript, and CSS files of a module can be loaded into the header of the page using $webutlercouple->autoheaderdata[].

$webutlercouple->autoheaderdata[] = '<link href="modulestyles.css" rel="stylesheet" type="text/css" />';
$webutlercouple->autoheaderdata[] = '<script src="modulescript.js"></script>';

The title of the Webutler page can be replaced with the variable $webutlercouple->setnewtitlefrommod by a more specific title from the module.

$webutlercouple->setnewtitlefrommod = 'My new page title';

Module Login

If you want the module has an administration area, there are 2 ways for a login:

  1. For the automatic login of the site operator can use the function $webutlercouple->checkadmin() checks whether the session data of the webmaster are set.
  2. Alternatively, a separate login administration for users who will only have access to the module to be created.

For the realization of a read and/or write access Webutler a registered user following session data of a user can be queried:

Groups-ID: $_SESSION['userauth']['groupid']
ID of the user: $_SESSION['userauth']['userid']
User name: $_SESSION['userauth']['username']
email address: $_SESSION['userauth']['usermail']

In the user manager users can be enabled, disabled or deleted. When the state is needed in a module, it must be scanned in the user DB. Return values:

Enabled: status='enabled'
Disabled: status='disabled'
Deleted: status='deleted'