Autoload File
The autoload file contains all the JS/CSS/Helper or any third-party file that needs to be loaded, in extension. For JS and CSS files use the separate array with specifying a key. As the config file, you don't need to load this file or variable anywhere it will load automatically at the time of the extension's activation.
How to load JS/CSS file
$config variable used for js/css
JS file
CSS file
The $config variable has an array containing file and location keys. 1. file:- this key has the path of the file. 2. location:- this key has an array of locations where you want to load this specific file. The value passed in this array is the controller name and method name such as controller_name/method_name, you can add multiple locations in this array.
Here is a stepwise syntax
Here is a real example
The same thing goes for CSS files, in place of js-files write css-files.
How to load Helpers file
Here is an example of a helper file.
$extension_helper variable used for loading helpers
In the $extension_helper array you can pass multiple helpers.
Use The custom helper on Controller
When you pass the helper name into the $extension_helper array it loads automatically on extensions loading. You can use it anywhere below is an example given how.
How to load Third-party files
miniCal allows you to use any third-party packages, either direct CDN path or you want to use downloaded one. Here is an example of the CDN path.
If you have your third-party package downloaded and want to load its js/css file then place the package under your extension folder. Here we have a third-party-package under our extension, this package has a city-name folder, and this folder has a city.js file.
Load downloaded package JS/CSS
The same thing goes for the CSS files just place the path of the CSS file.
Last updated