Setting a CSS File
To set a CSS file for your plugin you would point the Scripts class to the file like so:
global $_SCRIPTS; $_SCRIPTS->setCSSFile('polls', '/polls/style.css');
This tells the Scripts class to include the style sheet called polls. It is also telling the class that you plan to always include this CSS file. The reason you want to tell Geeklog that you plan to always include this CSS file is that it will then be marked for caching and compressing (future feature). If you plan to only include this CSS file on pages that the plugin displays you may want to include an extra parameter in the call to the class:
global $_SCRIPTS; $_SCRIPTS->setCSSFile('polls', '/polls/style.css', false);
As stated before this needs to be done before you run the function COM_SiteHeader or in your plugins plugin_getheadercode_foo function. If your plugin has a block or uses Autotags that need the CSS file then you should always make sure it is included since Geeklog has no way of knowing if a block or Autotag will be displayed before the header is written.
To load the jQuery libray included with Geeklog all you need to do is add the following code:
To load a jQuery UI widget all you need to do add the following code:
To load a jQuery UI effect all you need to do add the following code:
When loading an effect or widget you do not need to load the jQuery library first. When loading an effect or widget all the required files will be automatically set to load.
If a jQuery file is missing then the Google CDN-hosted copy will be substituted. There is also an option in the Geeklog Configuration under the Site tab to always use a CDN-hosted version of jQuery.
When loading one of the widgets or effects for jQuery UI you need to make sure to set it before COM_SiteHeader is executed or in your plugins plugin_getheadercode_foo function. The reason for this is the css files are set in COM_SiteHeader and we need to make sure that the CSS files for the UI plugin get set.