View
file
for the Products controller’s
“view()”
action, would normally be found in
src/Template/Products/view.ctp.
In short, the name of the controller (ProductsController) is same as the name of the folder
(Products) but without the word Controller and name of action/method (view()) of the
controller (ProductsController) is same as the name of the View file(view.ctp).
View Variables
View variables are variables which get the value from controller. We can use as many
variables in view templates as we want. We can use the
set()
method to pass values to
variables in views. These set variables will be available in both the view and the layout
your action renders. The following is the syntax of the
set()
method.
Cake\View\View::set(string $var, mixed $value)
This method takes two arguments —
Do'stlaringiz bilan baham: |