Skip to content
This repository has been archived by the owner on Oct 13, 2019. It is now read-only.

2.0: Writing and Addin

Jon Saxton edited this page May 10, 2015 · 1 revision

Writing in Addin for MomoKO 2.0

In MomoKO, and addin is a simple, often small, program that adds some functionality to MomoKO, it could add a section or page, for example a store front and/or shopping cart. It could add a sidebar module, for example the mini posts list, or it could add a layout, also know as a template. The type is specified in a file called the MANIFEST that must be included in all addins. This file also includes all the important information about the addin, like its name and who made it.

How you write you addins depends entirely on what type of addin you're writing so you have to decide this first. Is your addin only going to be a sidebar module, or are you going to be providing sections or pages to MomoKO. Perhaps you just want to write a new layout. No matter what the workflow is different for each type, so make sure you have decided this before you start.

The MANIFEST

The MANIFEST is written in ini format, and has three section denoted by brackets "[]". The [info] section, the [authorization] section, and the [attribution] section. Within each of these sections are a number of key="value" pairs. I'll go over each of these for each section.

Info

The info section contains basic information about you addin, this information is added to MomoKO's database

  • shortname - is a brief, less than a hundred character name of your addin to be displayed in the selection boxes
  • longname - is the full name of your addin, this may be the same as above
  • type - either; module, page, or template, denotes what kind of addin this is so MomoKO knows how to treat it.
  • description - is a brief description of your addin and should include what users should expect your addin to do, or how you addin works

Authorization

The authorization section shows who can access an addin and who cannot. This is only used by MomoKO for page type addins.

  • whitelist - who can access this new section or page
  • blacklist - who cannot

By default MomoKO prioritizes the whitelist over the blacklist, but this can be changed using the ALL keyword. For example:

whitelist="ALL"
blacklist="root"

means everyone can access your new section or page except for root, which is MomoKO's cli admin, but

whitelist="admin"
blacklist="root"

would still mean that only users in the admin group could access your addin. You can specify either system users, 'root' or 'guest', or uses system groups 'editor', 'users', 'admin'.

Attribution

This is where you give yourself credit for creating the addin. This is not used at the moment, but future versions will show this when users clicks an addin in the list, and it will also show in the addin marketplace once it is built.

  • author - your full name or screen name, depending on how you'd prefer to be credited
  • email - a valid e-mail so users can submit questions or bug reports about your addin
  • version - the current version of you addin, please follow MomoKO's versioning scheme

Example

[info]
shortname = "Simple&Clean"
longname = "Simple & Clean"
type = "template"
description = "A simple and clean layout with a three column header, two column body, and a single column footer"

[authorization]
whitelist = "ALL"
blacklist = "root"

[attribution]
author = "Jon Saxton"
email = "cem@tower21studios.com"
version = "0.1a"

The above is the MANIFEST from the "Simple & Clean" theme that will be included with the 2.0 release.

load.php, module.php, sample.tpl.htm

Aside from the MANIFEST your addin must contain one of three files depending on its type. Pages or sections should include load.php, modules should include module.php, and templates should include something like sample.tpl.htm where you would replace 'sample' with the name of your theme.