4 Modules - lilpug/ModFrame GitHub Wiki

Module Groups

In ModFrame modules are group by a parent folder, its main purpose is to ensure you can group core functionality that might require Models or caches being used in multiple modules.


Module Group Structure

A ModFrame module group should consist of the following structure:-


Modules\
         GroupName\
                    moduleName1\
                    moduleName2\
                    moduleName3\                                                   

Modules Folder

The Modules folder consists of a group layer which then holds the individual modules themselves.

A module folder is designed to be used to develop your core functionality for your website or API's.


Module Structure

A ModFrame module should consist of the following structure:-


Modules\
         GroupName\
                    moduleName\                    
                                controllers\*.cs
                                css\*.css
                                files\**
		                includes\
			                  header\*.cshtml
			                  footer\*.cshtml
		                js\*.js
                                models\*.cs (optional)
		                views\*.cshtml
                                plugins.json

The following is a brief description of what is required from each of the folders and files above:-


Controllers: The location where the MVC controllers are stored for a module.

CSS: The location where all the custom styles are stored for a module.

Files: The location where any files required in the module are placed i.e. images etc.

Includes: The location where all the CSS and JS HTML includes are stored for a module.

JS: The location where all the custom scripts are stored for a module.

Models: The locations where all the models can be stored for a module.

Views: The location where all the ".cshtml" view files are stored for a module.

Plugins.json: The file where any NPM and Bower plugin requirements are defined for a module.


Views

When creating a module view you might want to split it up into multiple ".cshtml" files.

You will need to use the ModuleView() function to include other ".cshtml" that are in the same module views directory.


Normal ModuleView Example

@*Imports the .cshtml file in the module views directory *@
@Html.ModuleView("Module Group Name Here", "Module Name Here", ".cshtml file here")

Model ModuleView Example

@*Imports the .cshtml file in the module views directory *@
@Html.ModuleView("Module Group Name Here", "Module Name Here", ".cshtml file here", Model)

⚠️ **GitHub.com Fallback** ⚠️