[#5765] Call CB theme parameters only on site's front CB pages

8 years 2 months ago - 8 years 2 months ago #277359 by joomforest
Hi all,

we are working on our new premium CB theme, and have a small issue ... we have that issue also on our "Connecto" theme, we dont know how to solve (haven't read all CB APIs :) ).

how to call theme parameter variables only on site frontpages and on all CB pages?

i mean, for example in our theme file in "root/components/com_comprofiler/plugin/templates/jf_connecto_cb_20/jf_connecto_cb_20.xml" we created a theme parameter:
<param name="my_simple_param" type="text" label="Simple Text" default="" description="" />

and in "root/components/com_comprofiler/plugin/templates/jf_connecto_cb_20/jf_connecto_cb_20.php" at bottom we call it like this:
global $_PLUGINS;
$params   = $_PLUGINS->getPluginParams( $plugin );
global $_CB_framework;

$doc = JFactory::getDocument();
$myparam = $params->get('my_simple_param');
$doc->addScriptDeclaration('alert(" '.$myparam.' ");');

but using like this, there we have 2 problems:
1) Theme Parameter is being called in CB adminside, even on "CB Admin Controlpanel";
2) Theme Parameter is NOT called on all CB frontpages, for example on" CB Activity" plugin page, or "CB Manage Connections" page, or on "CB Login" component page (index.php?option=com_comprofiler&view=login) .. and on many other pages. It is only being called on "Profile page", "User List" page and on some pages, and NOT on all pages.


we want to manipulate theme parameters only on site's all CB frontpages, and not on some of them, and not on "Joomla CB adminside",

can you please give us instructions how to achieve it?


Thank you so much,
Maksym from JoomForest

Please Log in to join the conversation.

8 years 2 months ago #277362 by krileon
Typically your CB template should strictly only be handling the 3 views we currently support in the template. These are as follows.

class CBProfileView_html_TEMPLATE extends cbProfileView
class CBRegisterFormView_html_TEMPLATE extends cbRegistrationView
class CBListView_html_TEMPLATE extends cbListView

Each has their own functions to alter the views. See the default template file below for these usages.

components/com_comprofiler/plugin/templates/default/default.php

Absolutely no logic should be done outside of a class/function beyond binding triggers. So for example if you want to add a script on the profile view you'd do this by binding to the profile display trigger and then adding your script through the function called by the trigger. Example as follows.

$_PLUGINS->registerFunction( 'onBeforeUserProfileDisplay', 'onBeforeUserProfileDisplay', 'cbmytemplatePlugin' );

class cbmytemplatePlugin extends PluginHandler
{
	public function onBeforeUserProfileDisplay()
	{
		global $_CB_framework;
		
		$_CB_framework;->document->addHeadScriptDeclaration( JS_HERE );
	}
}

You can find a large amount of the on display triggers in the below file.

components/com_comprofiler/comprofiler.html.php

You may not need to do this though if you just need to output to 1 of the 3 views supported by the templates build in classes as you'd add your script in their functions or in their constructor if needed.

I suppose worse case if you still need what you're using to work you can surround your code with a client id check to ensure it only executes on frontend. This is done as follows.

use CBLib\Application\Application;

if ( ! Application::Cms()->getClientId() ) {
	// FRONTEND ONLY
}

Note be sure to place use statements properly at the top of your PHP file.


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 #277381 by joomforest
hi,

thanks for answer,

so you mean there is no way to call template params on all cb pages? for example on "cb-groupjive" plugin pages?

how the cb theme's "bootstrap.css" gets loaded on all CB pages?

Best Regards,
Maksym

Please Log in to join the conversation.

8 years 2 months ago #277384 by krileon

so you mean there is no way to call template params on all cb pages? for example on "cb-groupjive" plugin pages?

Our templates don't work like that. They only execute their 3 classes and respective functions for those 3 specific usages. To add your code to GJ you'd need to act on a GJ trigger. If you still want to add your code directly to the templates PHP file and outside the scope of a class then you can, but It's not recommended.

how the cb theme's "bootstrap.css" gets loaded on all CB pages?

Bootstrap loading is built into CB. Drop a bootstrap.css in your templates folder and it'll load. Same for fontawesome.css.

What specifically are you trying to accomplish?


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 - 8 years 2 months ago #277403 by joomforest
we want:

1) To add/attach own "CSS/JS files" to CB theme;
2) To add "Inline CSS" styles, Attach font stylesheets (check our Free CB template www.joomforest.com/community-builder/templates/jf-connecto - exactly "Google Fonts" tab)

also in our premium CB theme we are planning to add "Mobile Toolbar", which params will be editable from "CB themes" ... or we will create Joomla module for it.

but all these features we want to apply on all CB pages, and not only on those 3 ones ...

problem is that if we style "CB Activity" or "CB GroupJive", it wont apply to plugin pages.
Yes, we can add CSS styles in "override.css", but, we cant apply CB theme params on those pages ...

so ... i guess a better solution is to create a Joomla module, which will do what we want :)

we are trying to create a standalone CB theme, which will work without depending on Joomla template (yes, joomla template styles always conflict with its extension styles, but we try minimize it, we try to make it unique and workable for all joomla sites without conflict).
Same we have done for JomSocial, Kunena, EasySocial templates - all our "extension themes" dont depend on Joomla templates, they have own features, own styles ... check our JomSocial theme features... for example www.joomforest.com/jomsocial/templates/jf-social - its features are editable from JomSocial Theme manager ...

Best Regards,
Maksym

Please Log in to join the conversation.

8 years 2 months ago #277407 by joomforest
small questions:

- is "uddeIM" popular in CB users? we are thiinking to style it or not ...
- is there "CB User Search" Module for Joomla? can find it, only found addon plugin ..

thank you very much,
Maksym

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.214 seconds

Facebook Twitter LinkedIn