Advanced module concepts

Sheet: Module advanced concept




Module events

Module has 4 events defined in the moduleevents.cs in the module project. You can use them to initialize database tables or CMS content folders.

OnInstalling: When module is being installed

OnUninstalling: When module is being uninstalled

OnIncluded: When module is being included into one website.

OnExcluded: When module is being excluded from a website



<InstallingTemplate /> and <UnInstallingTemplate />

This defines the view template to be showed during installation or uninstallation

Each module can have one module.config file defines setting values

< EntryOption />

One set of controller/action (URL) that will be rendered as default entry URL for the module when inserted into a page position. One module can have multiple EntryOption (or called EntryUrl)

<LinkToEntryName />

Used when an Entry URL want to link to another Entry URL from a different page. For example, display TOP 5 blogs in home page and link to blog page that contains blog module another Entry URL.

<CustomSettings />

API to access value, ControllerContext.GetModuleSettings().CustomSettings[""]


Data communication

ControllerContext.ShareData("key", values)

To share data between Entry URLs.


Data storage

Module data folder

Kooboo maintain three file folders for module accessible via APIs.
-  ControllerContext.GetModulPathHelper().GetModuleInstallationFilePath

The folder where the module installation file is located
-  ControllerContext.GetModulPathHelper().GetModuleSharedFilePath()

The folder shared by the same module from different websites

-  ControllerContext.GetModulPathHelper().GetModuleLocalFilePath()

The private data folder for each module under one website


Use External Database

-         Initialize the database table schema in the installing event.

-         Use Site.Current.FullName in the database table to separate module data.

Use Kooboo CMS for module content management

-         Initialize content type/schema and content folder on Installing

-         Use Kooboo API to query content


Define the Controller/action URL that you want them to appear in the left side bar of Kooboo CMS.