test
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • hcharly Friend
    #168734

    Hello All,

    I’m integrating JA Comment to the Mighty Resources Component.
    Does somebody knows what is the standard code to get Comments Count in a blog list?
    Thanks.
    -Charles

    hcharly Friend
    #414348

    Hello All,

    <em>@hcharly 268952 wrote:</em><blockquote>Hello All,

    I’m integrating JA Comment to the Mighty Resources Component.
    Does somebody knows what is the standard code to get Comments Count in a blog list?
    Thanks.
    -Charles</blockquote>

    I’m done. It’s working great!
    Here is how to integrate JA Comment to Mighty Resources CCK.

    1) In the files
    administrator / components / com_resource / xml / config_g.xml
    administrator / components / com_resource / xml / config.xml
    I added a new option to the “comments” parameter to support JA Comment OOTB
    – config_g.xml line 1110
    – config.xml line 1076


    <option value="4"> JAComments </option>

    This make it possible to select “JAComments” as a commenting system for MightyResources contents.

    2) Added some codes to the file components / com_resource / views / article / tmpl / default.php
    This codes enable the use of JA Comments for the specific Type for which it is selected.
    Find [php] echo $this-> LoadTemplate (‘comments’);[/php] near line 29
    and replace it by the following:
    [php]
    if($this->params->get(‘comments’) == 4 && file_exists(JPATH_BASE.DS. “/plugins/content/jacomment.php”)) {
    include_once(JPATH_BASE.DS. “/plugins/content/jacomment.php”);
    echo “{jacomment contentid=”.$this->article->id.” option=com_resource contenttitle=”.$this->article->title.”}”;
    } else {
    echo $this->loadTemplate(‘comments’);
    }
    [/php]
    This means that user can now use JAComment for some Resources’ contents while continuing
    to use the standard commenting component of MightyRes for other types.
    According to the code, the comment system which comes with MRes will be used if JA Comment is not installed and Selected.

    3) The last problem is to get the count of the number of comments to display on the Content lists and in Articles Views.
    To do that we need to edit the file components / com_resource / models / list.php.
    From line 2148 in function “countComments” just before
    [php] $db = & JFactory:: getDBO ();[/php]
    I put the following code to intercept the database querying:
    [php]
    if($params->get(‘comments’) == 4)
    {
    $comments = JPATH_SITE.DS.’components’.DS.’com_jacomment’.DS.’models’.DS.’comments.php’;
    if(file_exists($comments))
    {
    require_once ($comments);
    $jac_model = & JModel::getInstance(‘comments’,’JACommentModel’);
    $ja_query .= ‘ AND c.option=”com_resource”‘;
    $ja_query .= ‘ AND c.contentid=’.$item->id.”;
    $ja_query .= ‘ AND type=1’; //get only approved Items
    $count = $jac_model->getTotalByType($ja_query);
    if($count){
    $count = (int)array_sum($count);
    }else{
    $count = 0;
    }
    return $count;
    }
    }
    [/php]
    Without touching article.php in the same directory the count is correct for Article View also!
    This was enough to get the count of comments as well as Articles lists as on the Views. This works also for related content3.
    You won’t need to edit your previous “resources’ templates’!

    That’s it.
    -Charles
    I’ve posted these info at the Mighty Resources AngelDesk. Maybe they will implement this.

    jneubauer Friend
    #414356

    Thanks for all the hard work on this!
    And congratulations on implementing this successfully!
    I’ll bring this to the attention of the development team to see if this is something they might want to integrate from Joomlart as well!
    Thanks again!

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

This topic contains 3 replies, has 2 voices, and was last updated by  jneubauer 13 years, 3 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum