Dashboard Single Page not getting the Dashboard Theme
Permalink
I have a single page in the dashboard called companies located at '/dashboard/companies'. The default view of this page shows a list of companies. When you click on the name of the company, you are taken to the edit screen for that company, located at '/dashboard/companies/edit/{companyId}'.
In my DashboardCompaniesController, I have a method called 'edit'. The code for this method is:
I have a view setup in the '/single_pages/dashboard/companies' directory called 'edit_company.php'
All of the data is displaying correctly, but the page is receiving the front-end theme, not the dashboard theme. What am I doing wrong?
In my DashboardCompaniesController, I have a method called 'edit'. The code for this method is:
public function edit($companyId) { $this->render('dashboard/directory/edit_company'); }
I have a view setup in the '/single_pages/dashboard/companies' directory called 'edit_company.php'
All of the data is displaying correctly, but the page is receiving the front-end theme, not the dashboard theme. What am I doing wrong?
I had all of the code on the page correct for outputting the dashboard 'floating window' code, but it wasn't displaying the correct theme.
I dug into the code for $this->render(); a bit more and found that you can set the controller's theme just before calling render like so:
I dug into the code for $this->render(); a bit more and found that you can set the controller's theme just before calling render like so:
public function edit($companyId) { Loader::model('company'); $company = Company::getByID($companyId); $this->set('company', $company); $this->theme = 'dashboard'; $this->render('dashboard/company/edit_company'); }
Exactly what I needed. Thank you!
At the top of your view file (it wraps all of the content).
At the bottom, put a closing div.