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

Login with username, password and session length

JoomlaTune Support Forum    JComments component    Integration with third-party extensions    Topic: JComments Plugin for rdautos
Pages: [1]   Go Down
  Print  
Author Topic: JComments Plugin for rdautos  (Read 2389 times)
0 Members and 2 Guests are viewing this topic.
ebob
Newbie
*

Karma: 0
Offline Offline

Posts: 3


« on: October 26, 2010, 02:25:00 »

RD Autos is a Joomla component for listing vehicles for sale, it lacks a comment section. See this example of the current page structure: Muscle Cars muscle--cars.com/buick-street-rod

I have already created the following and placed in jcomments plugin folder and rdautos component, not sure of the next steps though. RD Autos author site is rd-media.org

<?php
class jc_com_rdautos extends JCommentsPlugin {
 
  function getObjectTitle( $id ) {
    // Data load from database by given id
    $db = & JFactory::getDBO();
    $db->setQuery( "SELECT title FROM #__rdautos WHERE id='$id'");
    return $db->loadResult();
  }
 
  function getObjectLink( $id ) {
    // Itemid meaning of our component
    $_Itemid = JCommentsPlugin::getItemid( 'com_rdautos' );
 
    // url link creation for given object by id
    $link = JRoute::_( 'index.php?option=com_rdautos&task=view&id='. $id .'&Itemid='. $_Itemid );
    return $link;
  }
 
  function getObjectOwner( $id ) {
    $db = & JFactory::getDBO();
    $db->setQuery( 'SELECT created_by, id FROM #__rdautos WHERE id = ' . $id );
    return $db->loadResult();
  }
}
?>

Logged
ebob
Newbie
*

Karma: 0
Offline Offline

Posts: 3


« Reply #1 on: October 26, 2010, 03:22:13 »

I figured most of this out and it is now installed and functioning. There is an issue though, comments from all pages post on all pages instead of just the page they are originally posted on.
« Last Edit: November 02, 2010, 06:28:24 by ebob » Logged
ebob
Newbie
*

Karma: 0
Offline Offline

Posts: 3


« Reply #2 on: October 26, 2010, 04:04:06 »

JComments Component For RD Autos on Muscle--Cars.com

So far I have been unable to locate the exact page in rd_autos to insert the code at the bottom of this Post, at the moment I have performed #4 through #9 but this causes comments from any page to be posted on all pages. I would appreciate jcomments author input on this.

1. Create a new file and name it com_rdautos.plugin.php

2. Place this code in the file:

<?php
class jc_com_rdautos extends JCommentsPlugin {
 
  function getObjectTitle( $id ) {
    // Data load from database by given id
    $db = & JFactory::getDBO();
    $db->setQuery( "SELECT title FROM #__rdautos WHERE id='$id'");
    return $db->loadResult();
  }
 
  function getObjectLink( $id ) {
    // Itemid meaning of our component
    $_Itemid = JCommentsPlugin::getItemid( 'com_rdautos' );
 
    // url link creation for given object by id
    $link = JRoute::_( 'index.php?option=com_rdautos&task=view&id='. $id .'&Itemid='. $_Itemid );
    return $link;
  }
 
  function getObjectOwner( $id ) {
    $db = & JFactory::getDBO();
    $db->setQuery( 'SELECT created_by, id FROM #__rdautos WHERE id = ' . $id );
    return $db->loadResult();
  }
}
?>

3. Upload this new file to:

components/com_rdautos
components/com_jcomments/plugins


4. Open Folder >components/com_rdautos 5. Open Folder >Views 6. Open Folder >Detail 7. Open Folder >TMPL 8. Open File >Default.php 9. At the very bottom of the page after </table> add the following code

<?php global $mosConfig_absolute_path;
  $comments = $mosConfig_absolute_path . '/components/com_jcomments/jcomments.php';
  if (file_exists($comments)) {
    require_once($comments);
    echo JComments::showComments($row->id, 'com_rdautos', $row->title);
  }?>
« Last Edit: November 02, 2010, 06:24:17 by ebob » Logged
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Integration with third-party extensions    Topic: JComments Plugin for rdautos
 
Jump to: