Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

Advanced Module CSS & Javascript files

edited July 2011 in Modules
Fuel CMS is great. I'm really enjoying learning and looking through it all. I had a post made about the javascript file loading but then saw in the newest version on Github it was already something changed. Thanks!

Comments

  • edited 10:34PM
    Glad you are finding FUEL CMS useful and thanks for the insight.

    I've just pushed some changes to allow for javascript files to be loaded that way so test it out and let me know if it fixes your problem:
    https://github.com/daylightstudio/FUEL-CMS/commit/e2c3149e96a70e8fdbd569b9b1e1147e41a67766

    With regards to the CSS, that's a bit trickier. The reason it's loaded on every page is because the CSS files may (and often do) contain CSS that is showed on every page. For example, the icons in the left menu for the module.
  • edited July 2011
    Awesome! I checked Github right before seeing your post and thought that change had already been in there, so I edited my original post, lol. Thanks for adding that!

    Yeah, that is a good point about the icons. Now that I look at the modules CSS files, they seem to only have CSS rules for the icons, so there is really not much CSS being loaded (and with caching on i'm sure it is quick). When I create an advanced module I'll use the default CSS file 'my_module.css' for just the icon information since all the other modules will be using it. Then I'll add another CSS file with the CSS rules for just that module and load it from the controller functions in the module.

    An issue I had with that though is that if I add the following code to the bottom of my controller function it will override all the CSS files set by _load_css() in the fuel_base_controller function.
    $load_vars['css'] = array('my_module_css');
    $this->load->vars($load_vars);
    That will override the CSS set by the header file.

    I looked at the load function in the codeigniter/core/Loader.php library and it didn't have any merge/append functionality in it. So I updated the $load_vars in my controller function to look like this:
    $load_vars['css'] = $this->load->_ci_cached_vars['css']
    $load_vars['css'][] = array('my_module_css');
    $this->load->vars($load_vars);
    Then I can get the CSS files that were already added and add another one in the controller function.

    Thanks again for the response. I'll keep on huffin this fuel!
Sign In or Register to comment.