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: JComment in Weblink?
Pages: [1]   Go Down
  Print  
Author Topic: JComment in Weblink?  (Read 6815 times)
0 Members and 1 Guest are viewing this topic.
tommyhome
Newbie
*

Karma: 0
Offline Offline

Posts: 12


WWW Email
« on: March 16, 2009, 04:47:49 »

Hi,
I would like to use JComments in the standard Joomla Weblink component, so that users might comment on categories and give tips on new links to add and so on, it is not needed to comment on individual links, but rather the categories, and the mainpage for the weblink component.

Is it possible?
Logged

//
Tommy, www.architechtsoftomorrow.com, site featuring JComments; www.airsoftvarberg.se
tommyhome
Newbie
*

Karma: 0
Offline Offline

Posts: 12


WWW Email
« Reply #1 on: March 16, 2009, 23:42:49 »

I solved it somewhat with the code on this site on other place, but it just refuses to post the category title, making it strange.

I use the same code, with slight modification on the POLL, and there it works like a charm.
Logged

//
Tommy, www.architechtsoftomorrow.com, site featuring JComments; www.airsoftvarberg.se
tommyhome
Newbie
*

Karma: 0
Offline Offline

Posts: 12


WWW Email
« Reply #2 on: March 17, 2009, 00:09:33 »

then I copied the the plugin for the poll and made some changes so it referred to the com_weblinks, and now it seems to work like it should.

I really like JComments.
Logged

//
Tommy, www.architechtsoftomorrow.com, site featuring JComments; www.airsoftvarberg.se
Sulpher
Newbie
*

Karma: 3
Offline Offline

Gender: Male
Posts: 21



WWW Email
« Reply #3 on: March 18, 2009, 13:58:56 »

tommyhome, cool! Feel free to share this trick within this forum giving short instruction how to implement JComments to the standart weblinks component.
Logged

tommyhome
Newbie
*

Karma: 0
Offline Offline

Posts: 12


WWW Email
« Reply #4 on: March 19, 2009, 07:41:30 »

sure,
here is how to get JComments in weblink, for J1.5x
1, create new PHP file from the following code;
Code:
<?php
/**
 * JComments plugin for Joomla com_weblinks component
 *
 * @version 1.4, based on the one for com_poll by Sergey M. Litvinov
 * @package JComments
 * @author Sergey M. Litvinov (smart@joomlatune.ru), Tommy Nilsson, tommy@architechtsoftomorrow.com
 * @copyright (C) 2006-2008 by Sergey M. Litvinov (http://www.joomlatune.ru), 2009 Tommy Nilsson www.architechtsoftomorrow.com
 * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
 **/
(defined('_VALID_MOS') OR defined('_JEXEC')) or die('Direct Access to this location is not allowed.');

class 
jc_com_weblinks extends JCommentsPlugin
{
function getObjectTitle($id)
{
$db = & JCommentsFactory::getDBO();
$db->setQuery'SELECT title FROM #__categories WHERE section = "com_weblinks" and id = ' $id );
return $db->loadResult();
}

function getObjectLink($id)
{
if (JCOMMENTS_JVERSION == '1.5') {
$db = & JCommentsFactory::getDBO();
$db->setQuery'SELECT alias FROM #__categories WHERE section = "com_weblinks" and id = ' $id );
$alias $db->loadResult();

$link 'index.php?option=com_weblinks&view=category&id='$id.':'.$alias;

require_once(JPATH_SITE.DS.'includes'.DS.'application.php');

$component = & JComponentHelper::getComponent('com_weblinks');
$menus = & JSite::getMenu();
$items $menus->getItems('componentid'$component->id);

if (count($items)) {
$link .= "&Itemid=" $items[0]->id;
}

$link JRoute::_($link);

} else {
$_Itemid JCommentsPlugin::getItemid'com_weblinks' );
$link sefRelToAbs'index.php?option=com_weblinks&amp;view=category&amp;id=' $id '&amp;Itemid=' $_Itemid );
}
return $link;
}
}
?>


2. save, name it: com_weblinks.plugin.php
upload to components -> com_jcomments -> plugins.

3, find the com_weblinks ->category -> default.php, it should be in your template dir, if not copy from the components -> com_weblinks -> views -> category -> tmpl folder, to yourtemplate -> com_weblinks ->category folder.

4, open the file that you copied/located in step 3
5, add the following code to the end of the file, the very bottom.
Code:
<?php
//Code for JComments, by Tommy Nilsson, architechtsoftomorrow.com
  
$comments 'components/com_jcomments/jcomments.php';
  if (
file_exists($comments)) {
    require_once(
$comments);
    echo 
JComments::showComments($this->category->id'com_weblinks'$this->category->title);
  }
?>


Now you got comments inside each category of the default weblink component.
« Last Edit: March 19, 2009, 07:56:09 by tommyhome » Logged

//
Tommy, www.architechtsoftomorrow.com, site featuring JComments; www.airsoftvarberg.se
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #5 on: March 19, 2009, 19:06:55 »

tommyhome, thanks for Weblinks plugin! It will be included in next JComments release!
Logged

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

Karma: 3
Offline Offline

Posts: 29



WWW
« Reply #6 on: March 21, 2009, 07:20:16 »

Thanks.
Very nice and easy to make a working plugin for jcomments.
Logged

Visit my JComments powered website
PC Adviser - IT Info & Shop in one place.
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    General discussion    Topic: JComment in Weblink?
 
Jump to: