test
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • guysmiley Friend
    #149903

    Greetings,

    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 Moderator
    #338217

    Hi 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 Friend
    #338251

    With your updated code, the following URL is produced:
    index.php?option=com_javoice&view=items&layout=item&cid=190&type=&Itemid=33#comment-197

    Notice how $type_id does not appear in the URL.

    Anonymous Moderator
    #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-197

    Notice 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 Friend
    #338746

    Thank 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]


Viewing 5 posts - 1 through 5 (of 5 total)

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