My controller : Controller/appController/OrdersController.php
I have a function named nocontact()
and I can pass variable to nocontact.ctp as follows:
$allNoContacts = $result;
$service_charge=$this->ServiceCharge->find('all');
$zero_service_charge=$this->ZeroServiceCharge->find('all');
$zero_service_charge=$zero_service_charge[0]['ZeroServiceCharge']['items'];
$this->set(compact('allNoContacts','service_charge','zero_service_charge'));
How can I pass this variable to all view files under OrdersController?
You can set the variable in beforeRender method of your OrdersController.
public function beforeRender() {
$this->set('name', 'value');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With