Persons page 3 of 4

Please note that this page is for demonstration purposes only and therefore it contains fictitious entries. Moreover, we didn't bother with design at all, so we just laid out plain cards in a grey style. To use a different card design, you need to modify the template file mimimi.app/Themes/default/list-persons.tpl.

Did you know?

The List controller was used to display this page. It is located in the module mimimi.app/Controllers/List/List.php.

This module contains only one little method run() to render a listing page according to additional parameters that could be present in the incoming URL.

Note that the List controller is written in such a way that it can be binded to another view, for example, named JSON, just via its URL. At the same time, it can be also binded to another model, for example, named Cars or Persons. This behavior is consistent with true MVC architecture.

Explain an example

To demonstrate this functionality, let's explain the following four URLs:

  1. https://your.site/list/for-persons/as-html - the first segment "list" means that we are requesting a controller named List, the second segment "for-persons" means that we want to bind it to a model named Persons, and the last segment "as-html" means that we also want to bind it to a view named Html.

  1. https://your.site/list/for-persons/as-json - this URL means that we want to bind the List controller to a model named Persons and to a view named JSON.

  1. https://your.site/list/for-cars/as-html - this URL means that we want to bind the List controller to a model named Cars and to a view named Html.

  1. https://your.site/list/for-cars/as-json - this URL means that we want to bind the List controller to a model named Cars and to a view named JSON.

Since the Persons model is considered the default model, its segment "for-persons" can be omitted. Similarly, the Html view is considered the default view, so its segment "as-html" can also be omitted. As a result, we get compact URLs like this:

  1. https://your.site/list
  2. https://your.site/list/as-json
  3. https://your.site/list/for-cars
  4. https://your.site/list/for-cars/as-json

Additionally, the listing URLs may end with a pagination segment in the form "page-NNN". For example:

The segment "page-1" can be omitted.

By the way

Any other URL that attempts to bind the listing controller to a model or view other than the four mentioned above (let's say Movies and ZIP, for example, - https://your.site/list/for-movies/as-zip) will result in a "404 Error" page. Because the List controller's method run() doesn't have a rule that allows pairing the controller with a model named Movies or a view named ZIP.

Another Links