CodeIgniter Forums
Best practice? templates vs CSS and Javascript - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Best practice? templates vs CSS and Javascript (/showthread.php?tid=58037)



Best practice? templates vs CSS and Javascript - El Forum - 05-08-2013

[eluser]bartgrrr[/eluser]
Hi,

Depending on the 'type of page' (form-, overview-, search-, chart page, ...) I need/shouldn't need to use certain css and or javascript files.
For instance, a form page doesn't benefit on including css and javascript files for displaying charts.

I see 2 solutions for this type of problem.

1. Create a template page for each page type. Each template page has it's own link and script tags.

2. Create 1 template page with specific placeholders, filled in by the controller methods ($this->template->write_view).

What is the best solution? ... Or is there even a better way?

I need to use templates (footer, topmenu, ... are injected by controllers)