Then in your functions.php or plugins.php file set these at the very beginnning, like:

// Path to the controllers folder.$engine=newAmostajo\LightweightMVC\Engine(// Path to the views folder.$views_path='path_to_views_folder',// Path to the controllers folder.$controllers_path='path_to_controllers_folder',// Namespace of your plugin or theme. For controller access$namespace='MyApp');

Usage

Models

In Lightweight MVC, a Model at the end is just a type of Wordpress post. Store your models at the models folder.

NOTE: There is no PHP logic in the view, just pure HTML, perfect for the designer to handle. Logic is placed in the controller.

You can place your views as please within the views folder. In example, let's assuming that the view file from above is
named profile.php, you can place it in a path like this:

[ROOT]
|---> [views]
||---> [books]
|||---> profile.php

The key locator for this view within the engine will be:

books.profile

NOTE: If this view is located inside a plugin, you can add the same hirachy in any theme to customize the view with the theme's styles. Lightweight MVC will give priority to the view located in the theme.

Something like this:

[THEME_ROOT]
|---> [views]
||---> [books]
|||---> profile.php

Controllers

Controllers are used to create handle any business logic and algorithms.

In the following example, we will use a controller to display the book profile.