Persons page 1 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:
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 namedPersons, and the last segment "as-html" means that we also want to bind it to a view namedHtml.
https://your.site/list/for-persons/as-json - this URL means that we want to bind the
Listcontroller to a model namedPersonsand to a view namedJSON.
https://your.site/list/for-cars/as-html - this URL means that we want to bind the
Listcontroller to a model namedCarsand to a view namedHtml.
https://your.site/list/for-cars/as-json - this URL means that we want to bind the
Listcontroller to a model namedCarsand to a view namedJSON.
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:
- https://your.site/list
- https://your.site/list/as-json
- https://your.site/list/for-cars
- 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:
- https://your.site/list/page-2
- https://your.site/list/as-json/page-3
- https://your.site/list/for-cars/page-4
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
https://your.site/ - go to homepage.
https://your.site/home/as-text - print the homepage's source code.
https://your.site/list - go to the list of persons.
https://your.site/list/as-json - get page 1 of persons as JSON package.
https://your.site/list/for-cars - go to the list of cars.
https://your.site/list/for-cars/as-json - get page 1 of cars as JSON package.
https://your.site/robots.txt - print robots.txt document.
https://your.site/sitemap.xml - print sitemap.xml document.