[SOLVED] Is it possible to put Jcomments comments in a tab instead of the bottom of the article?

5 years 4 months ago - 5 years 4 months ago #57671 by randonneur
Est-ce possible de mettre les commentaires Jcomments dans un tab au lieu du bas de l'article ?

Is it possible to put Jcomments comments in a tab instead of the bottom of the article?

Pierre A. Martin
community & web project manager diplômé
Valais (CH)

Please Log in or Create an account to join the conversation.

5 years 4 months ago - 5 years 4 months ago #57680 by ggppdk
Hello

You need either to have some PHP knowledge
or otherwise just try to apply the following without any errors


1. create a custom template in FLEXIcontent backend templates manager by copying an existing
(choose to copy a template that has TABs in item view, e.g. copy template "default")

2. click to edit the "item" layout of the new template

3. go to TAB "edit files" and click to edit the file "item.php"

4. click Load/customize system's default

5. find:
<?php
		// Find if at least one tabbed position is used
		$tabcount = 12; $createtabs = false;
		for ($tc=1; $tc<=$tabcount; $tc++) {
			$createtabs = @$createtabs ||  isset($item->positions['bottom_tab'.$tc]);
		}
	?>
 
	<?php if ($createtabs) :?>
		<!-- tabber start -->
		<div id="fc_bottom_tabset" class="fctabber group">

Above this line:
<?php if ($createtabs) :?>


Add:
<?php		
		// INJECT JCOMMENTS INSIDE A TAB
		ob_start();
		if ($this->params->get('comments') == 1) :
			if (file_exists(JPATH_SITE.DS.'components'.DS.'com_jcomments'.DS.'jcomments.php')) :
				require_once(JPATH_SITE.DS.'components'.DS.'com_jcomments'.DS.'jcomments.php');
				echo JComments::showComments($item->id, 'com_flexicontent', $this->escape($item->title));
			endif;
		endif;
		$comments_html = trim(ob_get_contents());
		$this->params->set('comments', 0);
 
		if ($comments_html) {
			$createtabs = 1;
			$tc = 1;  // TAB POSITION
			$tabpos_name  = 'bottom_tab'.$tc;
			$field = new stdClass();
			$this->params->set($tabpos_name.'_label', 'MY_LANG_STRING_COMMENTS');
			$this->params->set('comments', 0);
			$field->label = false;
			$field->name = $tabpos_name.'_comments';
			$field->display = $comments_html;
			$item->positions[$tabpos_name][] = $field;
		}
?>

make sure to set:
$tc = 1; // TAB POSITION

to be a TAB that does not exist , e.g. if you already have 3 TABs
set it to 4


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

5 years 4 months ago #57682 by ggppdk


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

5 years 4 months ago #57687 by randonneur

Pierre A. Martin
community & web project manager diplômé
Valais (CH)

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.