CodeIgniter Forums
View theming - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: View theming (/showthread.php?tid=86735)



View theming - Mni.day - 02-14-2023

Hi. How do I implement view theming?

Let's say a theme is a folder with templates.
PHP Code:
$theme 'classic'// get from some settings
return view($theme .'/users/profile'); 

What can I do to avoid duplicating this prefix in every method of every controller?


RE: View theming - UchihaSV - 02-14-2023

use $this property and define in initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)


RE: View theming - Mni.day - 02-15-2023

(02-14-2023, 10:01 PM)UchihaSV Wrote: use $this property and define in initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)

In BaseController class?


RE: View theming - UchihaSV - 02-16-2023

(02-15-2023, 10:39 AM)Mni.day Wrote:
(02-14-2023, 10:01 PM)UchihaSV Wrote: use $this property and define in initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)

In BaseController class?

yes