Login     Sign up
paul
Created a wiki page
Version status:
active
Origin

Assuming we are creating a new module named "Test". Module URI is "test".

Create a folder named "test". Then create 3 files in it.

test.info:

This is the information file. Change the test to your real module URI.

name = Test Module
version = 1.0
description = This is a test module.

test.install.php:

This is installation file. Change the test to your real module URI.

the "icon" is your module icon. It support Font-Awesome Icons 4.7(https://fontawesome.com/v4/icons/) and Material Icons (https://fonts.google.com/icons). For Material Icons you need to add a "mi-" in front the name. In this example, we use "mi-mood".

<?php
function test_menu() {
    $items = array();
    $items['test'] = array(
        'name'=>'Test Module',
        'type'=>'community',
        'icon'=>'mi-mood'
    );
    return $items;
}

test.php:

This is the main file. Change the test to your real module URI.

<?php
class test {
    function index() {
        $output = 'Hello Jcow Module!';
        $output .= button(['type'=>'link', 'uri'=>'test/page1', 'title'=>t('Demo Link')]);
        new_section( $output );
        render();
    }

    function page1() {
        $output = 'This is Page1';
        new_section( $output );
        render();
    }
}

After creating those files, upload the "test" folder to your Jcow modules folder (Jcow_installation_folder/modules). Then login your website as administrator, go to AdminCP -> Modules, enable the test module:

Finally, your members can see the module link from the menu: