Question:
How should the homepage of a website be made using the CakePHP 3.0 Framework (3.0.3)? This page has dynamic content.
What this page consists of: It is a page displaying the main products and product categories (both searched from the bank), and it will display different page components (buttons and menus) whether the user is logged in or not. This page should be accessible without any parameter passing via URL ( http://localhost:8765/
)
What I tried to do:
Edited the template Template/Pages/home.ctp
the PagesController
(both generated by bake
), the documentation is said to PagesController
is optional and for static pages (and is displayed when accessed the address http://localhost:8765/
).
What must be done to create a home page without this dynamic page being linked to a controller
that is necessarily linked to an entity and table?
Answer:
You can use Elements .
I don't see any problem with your PagesController
accessing data from multiple entities to assemble the View . Just make sure you're targeting each element of the home page for ease of maintenance in the future, as the home page changes the most during the lifecycle of a web application.