Ciwy Class
The Ciwy class permits to prepare the right environment for YUI components.
Initializing the Class
According with CodeIgniter, the Ciwy classe is initialized in your controller using the $this->load->library() function:
$this->load->library('ciwy');
Once loaded, the Ciwy object will be available using: $this->ciwy
Loading a CIwY component
To load a component (widget or array) to be used in CIwY, just use the $this->ciwy->loadComponent() function
$instance = $this->ciwy->loadComponent('calendar');
The function will return the name of the instance (automaticcaly generated) for the loaded component. It is possible to force the instance name.
Alternative syntax is permitted, in this case the function will return an array of istances where the key is the instance name and the value is the component name:
- Multiple component load with automatic instance name generation provided to the function as multiple function arguments
- Multiple component load with automatic instance name generation provided to the function as list of component name
- Multiple component load with given instance name provided to the function as associative array where the keys are the instance names and the values are the component names
$instance = $this->ciwy->loadComponent('animation', 'calendar', 'autocomplete');
$components_to_load = array('animation', 'calendar', 'autocomplete');
$instance = $this->ciwy->loadComponent($components_to_load);
$components_to_load = array('anim1' => 'animation', 'myCal' => 'calendar', 'ac_instance' => 'autocomplete');
$instance = $this->ciwy->loadComponent($components_to_load);
YUI components are automatic loaded by the CIwY component loader, if you need to load only YUI component, please see Loading a YUI component page.
See the CIwY Widget Reference and CIwY Utility Reference pages for more details.