• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[MagicResources] Autoload specific.js & .css files

This is a library who include all javascript and css necesary files. Avoid include unnecesary resources in every pages and load automatically resources based on a config file.

Oficial Helpers autoloaded: Url

How to use:

  1. Configure the application/config/resources.php config file
    PHP Code:
    //Resources applied to all methods of controller
    $config['resources_class'] = array("WELCOME","CONTROLLER1","CONTROLLER2");

    //List of resources of every controller's methods
    $config['resources'] = array(    "welcome.index"         => array("PARTICLES"),    "controller1.index"     => array("FONTAWESOME"),);

    //Resources loaded of every pages
    $config['resources_default'] = array("BOOTSTRAP","JQUERY""ANALYTICS"); 

  2. Define resources in application/config/Magicresources.php -> set_resource method:
    PHP Code:
    case "RESOURCE"//Name of the resource
    return  array("css" =>  array("paths/to/css/files"),"js" =>   array("paths/to/js/files"));

  3. Load library
    PHP Code:

  4. In the view, call Magic Resources's render method
    PHP Code:

Link to library: https://github.com/50l3r/CI-MagicResources

Nice done, thx for sharing!


it's time to share with the community Wink

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.