How do modules interact with the html page?


#1

Hi, I’m learning to create a module for Omeka S, and trying to wrap my head around how the php files of modules such as simple-carousel or html get called to the pages?

Thanks,
Luca


#2

Hi Luca,

I’ve been working on this too and here’s a summary of what I’ve found.

Omeka uses the Zend framework for modules. You can read much more about the process on the official Zend page.

Each module has a /Module.php file which sets the location of the config file.

The config (/config/module.config.php) registers controllers, factories, and routes for the module.

Registered routes (i.e. /admin/yourmodule/index) are associated with specific controllers and controller actions. If a route is called ( you clicked the /admin/yourmodule/index link), the request is sent to the controller, which determines which action to take (i.e. indexAction method). Actions can create views which use phtml templates (/view/yourmodule/index/index.phtml) to render the html of a page.

The Zend framework uses conventions to link a controller action (i.e. viewAction) to a file in the views folder (i.e. /view/yourmodule/index/view.phtml).

In Omeka, modules within the /modules folder (if configured correctly) will appear on the modules page (/omeka-s/admin/module). If you want module content to appear on the left side menu, you can add navigation to the module.config.php.

Good luck!