The FUEL Object Structure
FUEL CMS version 1.0 provides a powerful object oriented structure which allows you to easily access FUEL functionality within your own code. There is a fuel object set on the main CI super object (controller object accessed using the get_instance() function). This object allows access to your FUEL configuration as well as attaches other useful FUEL objects as shown below:
- $this->fuel (Fuel)
- $this->fuel->admin (Fuel_admin)
- $this->fuel->assets (Fuel_assets)
- $this->fuel->auth (Fuel_auth)
- $this->fuel->blocks (Fuel_blocks)
- $this->fuel->cache (Fuel_cache)
- $this->fuel->categories (Fuel_categories)
- $this->fuel->language (Fuel_language)
- $this->fuel->layouts (Fuel_layouts)
- $this->fuel->logs (Fuel_logs)
- $this->fuel->modules (Fuel_modules)
- $this->fuel->navigation (Fuel_navigation)
- $this->fuel->notification (Fuel_notification)
- $this->fuel->pages (Fuel_pages)
- $this->fuel->pagevars (Fuel_pagevars)
- $this->fuel->permissions (Fuel_permissions)
- $this->fuel->redirects (Fuel_redirects)
- $this->fuel->settings (Fuel_settings)
- $this->fuel->sitevars (Fuel_sitevars)
- $this->fuel->tags (Fuel_tags)
- $this->fuel->users (Fuel_users)
Basic Examples
// EXAMPLES if used in your controller $page = $this->fuel->pages->create(); $nav = $this->fuel->navigation->render(); $this->fuel->cache->clear(); $this->fuel->assets->upload();
All the above classes inherit from the Fuel_base_library class.
Advanced Module Objects
Additionally, you have access to advanced module objects if a class exists in the advanced module's libraries folder with a naming convention of Fuel_{module}.php. The following examples assume you have the advanced modules installed:
Advanced Module Examples
$posts = $this->fuel->blog->get_posts(); $this->fuel->backup->do_backup(); $this->fuel->validate->html('mypage'); $this->fuel->tester->run();
The main fuel object is an Advanced Module object. Review the Advanced Module Reference in this user guide for a list of methods available for your installed advanced modules.
The above advanced module classes inherit from the Fuel_advanced_module class (which itself inherits from the Fuel_base_library class).