[SOLVED] How to Call CB Theme params in Joomla module?

8 years 2 months ago - 8 years 2 months ago #277494 by joomforest
Hi,

how can i call CB theme parameter values in Joomla module?

i did it this way:
global $_CB_database;
if ( ( ! file_exists( JPATH_SITE . '/libraries/CBLib/CBLib/Core/CBLib.php' ) ) || ( ! 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' );
cbimport( 'cb.html' );
$query	=	'SELECT ' . $_CB_database->NameQuote( 'params' )
	.	"\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin' )
	.	"\n WHERE " . $_CB_database->NameQuote( 'name' ) . " = 'jf_connecto_cb_20'";
$_CB_database->setQuery( $query );
$loadResult 	= $_CB_database->loadResult();
$call_my_param 	= json_decode($loadResult)->custom_theme_param_name;
echo $call_my_param;


but maybe there is a better solution for calling CB theme params?


Thank you very much,
Maksym.

Please Log in to join the conversation.

8 years 2 months ago #277524 by krileon
Replied by krileon on topic How to Call CB Theme params in Joomla module?
After loading CB API you need to load the needed plugin group. Once that's loaded you can load a plugin by its id or element, but since id isn't static you need to do this by element. Below is an example of this usage.

if ( ( ! file_exists( JPATH_SITE . '/libraries/CBLib/CBLib/Core/CBLib.php' ) ) || ( ! 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' );

cbimport( 'cb.html' );
cbimport( 'language.front' );

$_PLUGINS->loadPluginGroup( 'templates' );

$plugin		=	$_PLUGINS->getLoadedPlugin( 'templates', 'PLUGIN_ELEMENT_HERE' );

if ( ! $plugin) {
	return;
}

$params		=	$_PLUGINS->getPluginParams( $plugin );

You can find the plugin element within CB > Plugin Management under the element column or by editing the plugin.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

8 years 2 months ago #277531 by joomforest
Replied by joomforest on topic How to Call CB Theme params in Joomla module?
thank you so much,

Best Regards

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.231 seconds

Facebook Twitter LinkedIn