Welcome Guest, Not a member yet? Register   Sign In
Asset Loader Library
#7

All my controllers extends a base controller. In there I have 2 private arrays for JS and CSS files. I have functions to inject the right filenames in these array for different needs. Let say I need jQuery and Font Awesome, my controller method will call some function that will add the JS and CSS files required for jQuery and FontAwesome. When I'm ready to call the view, I call a function that creates the links to be included in the view. Then the view simply output that variable that contains the HTML snippet to include the JS and CSS files. So all I have in my controller will be something like this->addJquery(),this->addFontAwesome(), this->getHeader().
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply


Messages In This Thread
Asset Loader Library - by MGatner - 03-14-2019, 07:28 AM
RE: Asset Loader Library - by MGatner - 03-15-2019, 04:45 PM
RE: Asset Loader Library - by dave friend - 03-17-2019, 09:10 AM
RE: Asset Loader Library - by PaulD - 03-16-2019, 08:29 AM
RE: Asset Loader Library - by includebeer - 03-16-2019, 03:43 PM
RE: Asset Loader Library - by MGatner - 03-16-2019, 03:59 PM
RE: Asset Loader Library - by MGatner - 03-16-2019, 03:52 PM
RE: Asset Loader Library - by includebeer - 03-16-2019, 04:13 PM
RE: Asset Loader Library - by MGatner - 03-16-2019, 04:57 PM
RE: Asset Loader Library - by MGatner - 03-17-2019, 03:55 PM
RE: Asset Loader Library - by MGatner - 03-18-2019, 01:21 PM
RE: Asset Loader Library - by MGatner - 03-19-2019, 08:31 AM
RE: Asset Loader Library - by MGatner - 03-25-2019, 01:10 PM
RE: Asset Loader Library - by MGatner - 10-07-2019, 12:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB