Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    JComments component    General discussion    Topic: load module position between article content and jcomments
Pages: [1]   Go Down
  Print  
Author Topic: load module position between article content and jcomments  (Read 3739 times)
0 Members and 1 Guest are viewing this topic.
gerfal
Newbie
*

Karma: 1
Offline Offline

Posts: 4


« on: June 06, 2010, 17:37:38 »

Hi !  Smiley

I'm trying to load a module on each article after the article content, but before article comments... Like if I added a {loadposition xxx} at the end of each articles...

Do you know how to do that?

thanks !
Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #1 on: June 07, 2010, 01:40:43 »

And what your problem with {loadposition xxx}? Insert this tag to article text and you will have module after article's text and before comments.
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
gerfal
Newbie
*

Karma: 1
Offline Offline

Posts: 4


« Reply #2 on: June 08, 2010, 02:42:58 »

Yes but I want the module position to be loaded on every articles of my website...

I could go throught every article to add the {loadposition } tag, and then add this tag for every new article I create, but I was thinking that there could be a better solution...  Huh
Logged
gerfal
Newbie
*

Karma: 1
Offline Offline

Posts: 4


« Reply #3 on: June 10, 2010, 00:02:57 »

I finaly solved my problem by adding :

Code:

$document = &JFactory::getDocument();
$renderer = $document->loadRenderer('modules');
$options = array('style' => 'xhtml');
$position = 'module_pos';
echo $renderer->render($position, $options, null);

 in the function "render" in tpl_index.php file .
Logged
Johnny_IC
Newbie
*

Karma: 0
Offline Offline

Posts: 2


Email
« Reply #4 on: June 20, 2010, 17:58:48 »

Hello!

I have the same problem as you.

I am a beginner, so I am interested in what I have to change in this code, because I have changed "module_pos" module name to my position name, but still a module in that position does not work.

Sorry for my English and thanks in advance!
Logged
gerfal
Newbie
*

Karma: 1
Offline Offline

Posts: 4


« Reply #5 on: June 20, 2010, 18:48:47 »

I don't know why it doesn't works for you...

Do you have inserted the code at the right place? It shoud be in components/com_jcomments/tpl/default/tpl_index.php if you use the default template. The file looks like :

Code:
<?php
// no direct access
(defined('_VALID_MOS') OR defined('_JEXEC')) or die('Restricted access');
/*
*
* Main template for JComments. Don't change it without serious reasons ;)
* Then creating new template you can copy this file to new template's dir without changes
*
*/
class jtt_tpl_index extends JoomlaTuneTemplate
{
function render() 
{

$object_id $this->getVar('comment-object_id');
$object_group $this->getVar('comment-object_group');

// comments data is prepared in tpl_list and tpl_comments templates 
$comments $this->getVar('comments-list''');

...

change it by

Code:
<?php
// no direct access
(defined('_VALID_MOS') OR defined('_JEXEC')) or die('Restricted access');
/*
*
* Main template for JComments. Don't change it without serious reasons ;)
* Then creating new template you can copy this file to new template's dir without changes
*
*/
class jtt_tpl_index extends JoomlaTuneTemplate
{
function render() 
{

//Load module position articlebottom

$document = &JFactory::getDocument();
$renderer $document->loadRenderer('modules');
$options = array('style' => 'xhtml');
$position 'articlebottom';
echo $renderer->render($position$optionsnull);



$object_id $this->getVar('comment-object_id');
$object_group $this->getVar('comment-object_group');

// comments data is prepared in tpl_list and tpl_comments templates 
$comments $this->getVar('comments-list''');

...


in my case, i load the position named 'articlebottom', but you can change the position by whatever you want
Logged
Johnny_IC
Newbie
*

Karma: 0
Offline Offline

Posts: 2


Email
« Reply #6 on: June 20, 2010, 18:53:25 »

Thank you very very much for your very very fast help!  Cheesy Cheesy

It works now! The problem was in inserted code at the wrong place!
Logged
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    General discussion    Topic: load module position between article content and jcomments
 
Jump to: