Community Builderの機能をコンポーネントから使う
ここ1ヶ月くらい作成中のJoomla!コンポーネントがようやく形になってきた。そのコンポーネント内部ではCommunity Builderで追加したフィールドの値を参照してる。
そうしたことをするには、以下のようなコードを埋め込む必要がある。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | global $_CB_framework , $ueConfig , $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' ); } cbimport( 'cb.plugins' ); cbimport( 'language.front' ); |
でないと、以下のようなエラーが出る。
1 | Fatal error: Class 'comprofilerDBTable' not found in /path/to/joomla/administrator/components/com_comprofiler/library/cb/cb.tables.php on line 16 |
詳しくはここを参照。
環境:
Joomla 1.5.15
Community Builder 1.2.2