×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: [SOLVED]How to display the compojoomcomment after a module ?

[SOLVED]How to display the compojoomcomment after a module ? 13 years 1 month ago #14167

  • kang frederic
  • kang frederic's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0
Hi,

I just installed the compojoom extension (which turns out to be a component and not a module), and its look great.
However, I have a problem :
I have a module that I need to be displayed right after articles. So far, I didnt manage to display the component after the module.

How can I do what I want ?

[SOLVED]How to display the compojoomcomment after a module ? 13 years 1 month ago #14171

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Kang,
How do you load this module after the article?

Do you use {loadPosition position_id} in your content or what?

Cheers,
Daniel

[SOLVED]How to display the compojoomcomment after a module ? 13 years 1 month ago #14172

  • kang frederic
  • kang frederic's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0
Hi Daniel,

I do not use the loadmodule trick, but the usual way.
I heard about that trick, but in case i expect to have Panthéon articles, and I would spend to much time trying to add it one n'y one in every single articles.

[SOLVED]How to display the compojoomcomment after a module ? 13 years 1 month ago #14173

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hi Kang,
So here is why you see the comments first:

You have your component and this component has something like a hook - a plugin event - onAfterDisplayContent. This is where the comments get displayed. And after the article you most probably have a module position to which you have attached your module.
so the display is like this:
1. article
2. all plugins that attach themselves to onAfterDisplayContent
3. going on with your joomla template - most probably other modules.

So to overcome this problem and to display them in this order:
1. article
2. some modules
3. all plugins that attach themselves to onAfterDisplayContent

You need to do a little bit modifications to your templates.

First you need to learn what joomla overrides are:
docs.joomla.org/How_to_override_the_outp...rom_the_Joomla!_core

So, once you know what they are - you have to override the article view of com_content (components/com_content/views/articles.php)

in this file you will see something like this
<?php echo $this->event->onAfterDisplayContent; ?>

before this code you will need to place the code that will invoke a module. Read this:
www.theartofjoomla.com/home/6-layouts/12...ayout-overrides.html

So basically you will need to put something like this
<?php
    $document	= &JFactory::getDocument();
    $renderer	= $document->loadRenderer('modules');
    $options	= array('style' => 'xhtml');
    $position	= 'YOUR_NEW_MODULE_POSITION';
 
    echo $renderer->render($position, $options, null);
?>
Once you do this you can sett the position of your module to 'YOUR_NEW_MODULE_POSITION' and the modules that are assigned to this position will show in article view.

Cheers,
Daniel

[SOLVED]How to display the compojoomcomment after a module ? 13 years 1 month ago #14183

  • kang frederic
  • kang frederic's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0
Well,

Thank you Daniel for your reply,

Unfortunately, the file "components/com_content/views/articles.php" doesnt exist and according to the how to override, I proceed with the file" /com_content/views/article/tmpl/default.php"

But when I look into it I have "
item->event->afterDisplayContent; ?>
instead of
item->event->onAfterDisplayContent; ?>

I kept doing as you said, but there is no changes :(

[SOLVED]How to display the compojoomcomment after a module ? 13 years 1 month ago #14189

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Obviously I was writing without checking if the files I mention exists. Sorry about that.
the right file is: /com_content/views/article/tmpl/default.php

and the right event is the event you say.

Did you publish the module to your new position?

Daniel

[SOLVED]How to display the compojoomcomment after a module ? 13 years 1 month ago #14192

  • kang frederic
  • kang frederic's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0
No problem Daniel, I am already glad that you spend some time trying to solve my problem :
So, thisis what I have in com_content\views\article\tmpl\default.php
item->params;
$canEdit	= $this->item->params->get('access-edit');
$user		= JFactory::getUser();
?>
">
params->get('show_page_heading', 1)) : ?>
 
	escape($this->params->get('page_heading')); ?>
 
 
get('show_title')) : ?>
 
	get('link_titles') && !empty($this->item->readmore_link)) : ?>
		readmore_link; ?>">
		escape($this->item->title); ?>
 
		escape($this->item->title); ?>
 
 
 
 
get('show_print_icon') || $params->get('show_email_icon')) : ?>
 
	print) : ?>
		get('show_print_icon')) : ?>
 
			item, $params); ?>
 
 
 
		get('show_email_icon')) : ?>
 
			item, $params); ?>
 
 
 
 
 
			item, $params); ?>
 
 
 
 
 
		item, $params); ?>
 
 
 
 
 
 
get('show_intro')) :
	echo $this->item->event->afterDisplayTitle;
endif; ?>
 
item->event->beforeDisplayContent; ?>
 
get('show_author')) OR ($params->get('show_category')) OR ($params->get('show_parent_category'))
	OR ($params->get('show_create_date')) OR ($params->get('show_modify_date')) OR ($params->get('show_publish_date'))
	OR ($params->get('show_hits'))); ?>
 
 
 
 
 
get('show_parent_category') && $this->item->parent_slug != '1:root') : ?>
 
	escape($this->item->parent_title);
	$url = 'item->parent_slug)).'">'.$title.'';?>
	get('link_parent_category') AND $this->item->parent_slug) : ?>
 
 
 
 
 
 
get('show_category')) : ?>
 
	escape($this->item->category_title);
	$url = 'item->catslug)).'">'.$title.'';?>
	get('link_category') AND $this->item->catslug) : ?>
 
 
 
 
 
 
get('show_create_date')) : ?>
 
	item->created, JText::_('DATE_FORMAT_LC2'))); ?>
 
 
get('show_modify_date')) : ?>
 
	item->modified, JText::_('DATE_FORMAT_LC2'))); ?>
 
 
get('show_publish_date')) : ?>
 
	item->publish_up, JText::_('DATE_FORMAT_LC2'))); ?>
 
 
get('show_author') && !empty($this->item->author )) : ?>
 
	item->created_by_alias ? $this->item->created_by_alias : $this->item->author; ?>
	item->contactid) && $params->get('link_author') == true): ?>
	item->contactid;
		$item = JSite::getMenu()->getItems('link', $needle, true);
		$cntlink = !empty($item) ? $needle . '&Itemid=' . $item->id : $needle;
	?>
 
 
 
 
 
 
get('show_hits')) : ?>
 
	item->hits); ?>
 
 
 
 
 
 
item->toc)) : ?>
	item->toc; ?>
 
get('access-view')):?>
	item->text; ?>
 
 
get('show_noauth') == true AND  $user->get('guest') ) : ?>
	item->introtext; ?>
 
	get('show_readmore') && $this->item->fulltext != null) :
		$link1 = JRoute::_('index.php?option=com_users&view=login');
		$link = new JURI($link1);?>
 
 
		item->attribs);  ?>
		alternative_readmore == null) :
			echo JText::_('COM_CONTENT_REGISTER_TO_READ_MORE');
		elseif ($readmore = $this->item->alternative_readmore) :
			echo $readmore;
			if ($params->get('show_readmore_title', 0) != 0) :
			    echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
			endif;
		elseif ($params->get('show_readmore_title', 0) == 0) :
			echo JText::sprintf('COM_CONTENT_READ_MORE_TITLE');
		else :
			echo JText::_('COM_CONTENT_READ_MORE');
			echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
		endif; ?>
 
 
 
item->event->afterDisplayContent; ?>
And what I have in myTemplate/html/com_content/article/default.php
getTemplate(true)->params;
JHtml::addIncludePath(JPATH_COMPONENT.DS.'helpers');
 
// Create shortcut to parameters.
$params = $this->item->params;
 
if ($templateparams->get('html5') != 1) :
	require(JPATH_BASE.'/components/com_content/views/article/tmpl/default.php');
	//evtl. ersetzen durch JPATH_COMPONENT.'/views/...'
 
else :
	JHtml::addIncludePath(JPATH_COMPONENT.DS.'helpers');
?>
">
params->get('show_page_heading', 1)) : ?>
 
params->get('show_page_heading', 1) And $params->get('show_title')) :?>
 
 
 
	escape($this->params->get('page_heading')); ?>
 
 
get('show_title')|| $params->get('access-edit')) : ?>
 
			escape($this->item->title); ?>
 
 
params->get('show_page_heading', 1) And $params->get('show_title')) :?>
 
 
 
get('access-edit') ||  $params->get('show_print_icon') || $params->get('show_email_icon')) : ?>
 
		print) : ?>
				get('show_print_icon')) : ?>
 
						item, $params); ?>
 
 
 
				get('show_email_icon')) : ?>
 
						item, $params); ?>
 
 
				user->authorise('core.edit', 'com_content.article.'.$this->item->id)) : ?>
 
							item, $params); ?>
 
 
 
 
						item, $params); ?>
 
 
 
 
 
	get('show_intro')) :
		echo $this->item->event->afterDisplayTitle;
	endif; ?>
 
	item->event->beforeDisplayContent; ?>
 
get('show_author')) OR ($params->get('show_category')) OR ($params->get('show_parent_category'))
	OR ($params->get('show_create_date')) OR ($params->get('show_modify_date')) OR ($params->get('show_publish_date'))
	OR ($params->get('show_hits'))); ?>
 
 
 
 
 
get('show_parent_category') && $this->item->parent_slug != '1:root') : ?>
 
			escape($this->item->parent_title);
					$url = 'item->parent_slug)).'">'.$title.'';?>
			get('link_parent_category') AND $this->item->parent_slug) : ?>
 
 
 
 
 
 
get('show_category')) : ?>
 
			escape($this->item->category_title);
					$url = 'item->catslug)).'">'.$title.'';?>
			get('link_category') AND $this->item->catslug) : ?>
 
 
 
 
 
 
get('show_create_date')) : ?>
 
		item->created, JText::_('DATE_FORMAT_LC2'))); ?>
 
 
get('show_modify_date')) : ?>
 
		item->modified, JText::_('DATE_FORMAT_LC2'))); ?>
 
 
get('show_publish_date')) : ?>
 
		item->publish_up, JText::_('DATE_FORMAT_LC2'))); ?>
 
 
get('show_author') && !empty($this->item->author )) : ?>
 
		item->author; ?>
		item->created_by_alias ? $this->item->created_by_alias : $author);?>
 
			item->contactid ) &&  $params->get('link_author') == true):?>
				item->contactid),$author)); ?>
 
 
 
 
 
 
get('show_hits')) : ?>
 
		item->hits); ?>
 
 
 
 
 
 
	item->toc)) : ?>
		item->toc; ?>
 
 
	item->text; ?>
 
	loadRenderer('modules');
		$options    = array('style' => 'xhtml');
		$position    = 'mPosition';
		echo $renderer->render($position, $options, null);
	?>
 
	item->event->afterDisplayContent; ?>
 
 
 

I added this in the index.php of my template
jdoc:include type="component"
jdoc:include type="modules" name="mPosition"

The module is published on this position
I still have the display :
1. article
2. comment plugin
3. module

You can have look over here : laireduvin

[SOLVED]How to display the compojoomcomment after a module ? 13 years 1 month ago #14193

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Please use this pastebin.com/ and paste your php code there.

The changes that you made to your template index.php files are unnecessary.

Daniel

[SOLVED]How to display the compojoomcomment after a module ? 13 years 1 month ago #14195

  • kang frederic
  • kang frederic's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0
So, this is the code in the views_article_tmpl_default.php

And this is the code in the
html_com_content_article_default.php
Looks like the file has already been overrided

We may have a hint, because if i do not call the module in my index.php, the module is not displayed. Just like now.

By the way, do I need to update the file templateDetails.xml ? I think that I dont need, but I am asking just in case.

[SOLVED]How to display the compojoomcomment after a module ? 13 years 1 month ago #14196

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Everything seems correct. So is the module published to the mPosition on allpages - you have to assign it to all pages.
Daniel

[SOLVED]How to display the compojoomcomment after a module ? 13 years 1 month ago #14203

  • kang frederic
  • kang frederic's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 14
  • Thank you received: 0
Yes !!

i finally know what were wrong !
It was because of a HTML5 condition at the begining of the file.
I commented it and it is now working :)

[SOLVED]How to display the compojoomcomment after a module ? 13 years 1 month ago #14207

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Hey Kang,
That is awesome!
Don't forget to leave a review about the support here ;):
extensions.joomla.org/extensions/contact...icles-comments/12259

Cheers,
Daniel
  • Page:
  • 1
Time to create page: 0.183 seconds