Programming your own modules

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__/...).

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' => '__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 has to provide an arrays containing the URLs of the module and optionally a timestamp of the last edit as well as hreflang URLs - more Infos

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

Header / footer data

Javascripts and CSS files of a module must be entered in the file /settings/compress.php. Additional data for the header or footer can be loaded into the page using $webutlercouple->autoheaderdata[] or $webutlercouple->autofooterdata[].

$webutlercouple->autoheaderdata[] = '<meta name="designation" content="description" />';
$webutlercouple->autofooterdata[] = '<script src="external_script.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.

Admintoken

For admins an admintoken is placed into the session. The admintoken can be checked with $webutlercouple->checktoken() and be extended with "&admintoken=<?PHP echo $_SESSION['admintoken']; ?>".

Read / write access

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']

User manager

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'