-
AuthorPosts
-
guysmiley Friend
guysmiley
- Join date:
- October 2006
- Posts:
- 50
- Downloads:
- 0
- Uploads:
- 6
- Thanked:
- 5 times in 1 posts
March 28, 2010 at 7:04 pm #149903Greetings,
The JComments’ Latest Comments module does not work correctly with JAVoice because a plugin is required.
According to JComments’ documentation, in order for the Latest Comments to show up in the ‘Latest Comments’ module, a JComments plugin needs to be created for JA Voice. I’ve done most of the work, but I can’t seem to get JComments to load JAVoice’s $type_id in the URL (near bottom of code):
[PHP]
<?php
/**
* JComments plugin for JCalPRO events support
*
* @version 2.0
* @package JComments
* @author Sergey M. Litvinov (smart@joomlatune.ru)
* @copyright (C) 2006-2009 by Sergey M. Litvinov (http://www.joomlatune.ru)
* @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_javoice extends JCommentsPlugin
{
function getObjectTitle($id)
{
$db = & JCommentsFactory::getDBO();
$db->setQuery( ‘SELECT title AND voice_types_id FROM #__jav_items WHERE id = ‘ . $id );
return $db->loadResult();
}function getObjectLink($id)
{
$_Itemid = JCommentsPlugin::getItemid( ‘com_javoice’ );
$link = JoomlaTuneRoute::_(‘index.php?option=com_javoice&view=items&layout=item&cid=’ . $id . ‘&type=’ . $type_id . ‘&Itemid=’ . $_Itemid);
return $link;
}
}
?>[/PHP]This plugin file must be placed in the com_jcomments/plugin folder manually.
Anonymous ModeratorJA Developer
- Join date:
- September 2014
- Posts:
- 9914
- Downloads:
- 207
- Uploads:
- 152
- Thanks:
- 1789
- Thanked:
- 2008 times in 1700 posts
March 29, 2010 at 9:03 am #338217Hi guy,
setQuery( ‘SELECT title AND voice_types_id FROM #__jav_items WHERE id = ‘ . $id );
=> This is wrong
It must be:
setQuery( ‘SELECT title, voice_types_id FROM #__jav_items WHERE id = ‘ . $id );
guysmiley Friendguysmiley
- Join date:
- October 2006
- Posts:
- 50
- Downloads:
- 0
- Uploads:
- 6
- Thanked:
- 5 times in 1 posts
March 29, 2010 at 11:19 am #338251With your updated code, the following URL is produced:
index.php?option=com_javoice&view=items&layout=item&cid=190&type=&Itemid=33#comment-197Notice how $type_id does not appear in the URL.
Anonymous ModeratorJA Developer
- Join date:
- September 2014
- Posts:
- 9914
- Downloads:
- 207
- Uploads:
- 152
- Thanks:
- 1789
- Thanked:
- 2008 times in 1700 posts
March 31, 2010 at 8:33 am #338563<em>@guysmiley 171981 wrote:</em><blockquote>With your updated code, the following URL is produced:
index.php?option=com_javoice&view=items&layout=item&cid=190&type=&Itemid=33#comment-197Notice how $type_id does not appear in the URL.</blockquote>
Hi Guysmiley,
‘&type=’ . $type_id in the “getObjectLink” function, the ‘$type_id’ variable in this function has not been defined.
Please check again. If you still face the problem, kindly give me FTP & admin account and describe the issue in more details for a closer look.
guysmiley Friendguysmiley
- Join date:
- October 2006
- Posts:
- 50
- Downloads:
- 0
- Uploads:
- 6
- Thanked:
- 5 times in 1 posts
April 1, 2010 at 10:25 am #338746Thank you. Changes look great and work well. Joomlart’s updated code is below and I’ve attached the file that needs to go in components/com_jcomment/plugins/
[PHP]<?php
/**
* JComments plugin for JCalPRO events support
*
* @version 1.0
* @package JComments
* @author Joomlart
* @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_javoice extends JCommentsPlugin
{
function getObjectTitle($id)
{
$db = & JCommentsFactory::getDBO();
$db->setQuery( ‘SELECT title, voice_types_id FROM #__jav_items WHERE id = ‘ . $id );
return $db->loadResult();
}function getObjectLink($id)
{
$_Itemid = JCommentsPlugin::getItemid( ‘com_javoice’ );//get type_id
$db = & JCommentsFactory::getDBO();
$db->setQuery( ‘SELECT voice_types_id FROM #__jav_items WHERE id = ‘ . $id );
$type_id = $db->loadResult();$link = JoomlaTuneRoute::_(‘index.php?option=com_javoice&view=items&layout=item&cid=’ . $id . ‘&type=’ . $type_id . ‘&Itemid=’ . $_Itemid);
return $link;
}
}
?>[/PHP]
-
AuthorPosts
This topic contains 5 replies, has 2 voices, and was last updated by guysmiley 14 years, 8 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum