Login

Include CB API PDF Print E-mail
Tutorials - Joomla
Tuesday, 23 June 2009 16:15
Ever wonder if you can design your Joomla components to work on any platform easily? You can actually, but keep note this requires Community Builder to be installed. You can include the CB API directly into your modules, components, or plugins. You will then have the power of CB API at your finger tips.

Include CB Foundation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
global $_CB_framework, $mainframe;
 
if ( defined( 'JPATH_ADMINISTRATOR' ) ) {
if ( ! file_exists( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' ) ) {
echo 'CB not installed!';
return;
}
 
include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' );
} else {
if ( ! file_exists( $mainframe->getCfg( 'absolute_path' ) . '/administrator/components/com_comprofiler/plugin.foundation.php' ) ) {
echo 'CB not installed!';
return;
}
 
include_once( $mainframe->getCfg( 'absolute_path' ) . '/administrator/components/com_comprofiler/plugin.foundation.php' );
}


Now the above will give you access to many of the functions provided by the foundation and in most cases this is all you'll need. However if you want to use class functions and plugin functions or even database functions you need to follow the include with a cb import.

Include Database Functions
1
cbimport( 'cb.database' );

Include Frontend Language Definitions
1
cbimport( 'language.front' );

Include Snoopy Functions
1
cbimport( 'cb.snoopy' );

Include Image Toolbox Functions
1
cbimport( 'cb.imgtoolbox' );

Include Class & Plugin Functions
1
cbimport( 'cb.html' );

Include Plugin Functions
1
cbimport( 'cb.plugins' );
Last Updated on Wednesday, 31 March 2010 08:53
 

You are not authorized to comment on this content.