CodeIgniter Forums
how to use decorators to dry my views with CI3 - 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: how to use decorators to dry my views with CI3 (/showthread.php?tid=63858)



how to use decorators to dry my views with CI3 - jaynarayan - 12-15-2015

Hi all , thanks for reading

I  want to  implement  decorator pattern to dry my views with CI3.  

after reading this  tutorials and brain storming i came up with this ideas

1) decorate should be able to decorate single record as well as result set
2) make use of composer and/or psr autoloading 
3) can be used with HMVC  ( i use wiredesign extension)
4) use it with  or without template system( template library , partial view , view fragment etc)
5) where to place decorators
     -- In decorators folder. And create a library to load decoraters from it.
     -- create each decorators as individual  library and load it in controllers
     -- If using HMVC putting  decorators in each modules
     -- in vendor folder (in case of composer)

If you have use decorators  please suggest me some code examples.
(English is my third language.forgive me for mistake )