Is it possible to pass data from a controller to an element?


#1

Is it possible to pass data from a controller to an element? in this way:

Controller:

$this->set('datosNombre', $datosNombre);
$this->render('/elements/entrada');

Element:

$nombrePersona = $datosNombre->nombre;
$primerApellidoPersona = $datosNombre->primer_apellido;
$segundoApellidoPersona = $datosNombre->segundo_apellido;

#2

Elements are not something what you supposed to render directly from a controller. Elements are called from a template.

https://book.cakephp.org/3.0/en/views.html#elements


#3

@bichomen Casing matters :slight_smile:

Should be $this->render('/Elements/entrada');