Welcome Guest, Not a member yet? Register   Sign In
Thoughts on sending data to library from view
#1

Hi

What are your thoughts on sending data to a library directly from a view and not a controller?

I know it does not follow the MVC pattern but here's why in this scenario i think its useful.

I'm working on a basic theme library that will parse the css and js files to the view dynamically dependent on what the developer wants / needs.

In most libraries this would be done in the controller doing something like this :

$this->Theme->add_css('file1.css, file2.css');

Its useful that we only include css and js files that are needed for that's specific page instead of having a huge list of additional files slowing down page load that may not be needed for that specific page.

But ...

If we want to develop themes for a specific application that may rely on different files for the same page then modifications would need to be made in the controller and its no longer a drop in replacement of themes.

for example lets say we have an application and on our customers page we are using datatables to display our data, we only load the specific css and js file for the datatables for that page. But what if our second theme does not use datatables and uses something else.

This is where i think it would be more efficient to add the required files from the view, allowing the theme designer to include the necessary files within the theme and would serve as a drop in theme with no modification to the controller.

What are your thoughts?
Reply


Messages In This Thread
Thoughts on sending data to library from view - by Geeklabs - 12-16-2020, 06:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB