| 

Our Tutorials

Tutorial Library

Including CB API for usage outside of CB

Tutorials - API usage

User Rating: / 1
PoorBest 

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
cbimport( 'cb.database' );

 

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

 

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

 

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

 

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

 

Include Plugin Functions
cbimport( 'cb.plugins' );
Professional Member
Professional badge
As a Professional member you get all the Advanced privileges (CB detailed documentation, 17+ CB Add-ons, 11 GroupJive) and access to our same or next business day response time support forum for all your websites and our 26+ Incubator add-ons! That's a lot of add-ons that you can use on all your websites for ever!

 

Only 119 € for 12 months


Go Professional Now!