phpcakephpcakephp-3.0view-templates

Cakephp 3.0 how to create files for URL like domain.com/Products/Category1/Sub-Category1/1


Im new with CakePhp.

I understand how to create .ctp files in folder structure to have a URL navigation as

domain.com/HW_Products/1
domain.com/HW_Products/2
domain.com/SW_Products/1
domain.com/SW_Products/2

But I have many categories in my Products. How and where to create these .cpl files for each?

domain.com/Products/Category1/Sub-Category1/1
domain.com/Products/Category1/Sub-Category1/2
domain.com/Products/Category1/Sub-Category2/1
domain.com/Products/Category1/Sub-Category3/1
domain.com/Products/Category2/Sub-Category1/1
domain.com/Products/Category2/Sub-Category1/1
etc..

Solution

  • The view template path structure depends on routes, prefixes, controller names, action names, request content types, etc... just from looking at the URLs it's pretty hard to tell how it should look like without knowing how, and what exactly /Products/Category1/Sub-Category1/1 connects to.

    You might get better answers if you add some more details to your question, without further information all I can say suggest is, enable debug mode, navigate to your URLs, and voilá, CakePHP will throw error pages that tell you where to create the files in case they do not exist.