CodeIgniter Forums
Template data title from db - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: Template data title from db (/showthread.php?tid=87838)



Template data title from db - pippuccio76 - 06-06-2023

Hi in my project i use a template .
Wich is the best way to set tag title getting data from db , i would be set in only one function  (not in every controller set $data['title'] = .... )? 
Must i use base controller to do this ?


RE: Template data title from db - sheilaf - 06-06-2023

BaseController makes sense to me. Add a protected var and assign it a value in initController(). Then you can change the value in any other controller as needed.


RE: Template data title from db - InsiteFX - 06-06-2023

You could also use CodeIgniters Settings.
Provides database storage and retrieval of application settings, with a fallback to the config classes.

CodeIgniter 4 Settings