By Denis on Tuesday, 29 July 2014
Posted in General Issues
Replies 15
Likes 0
Views 1.1K
Votes 0
Hello everyone,

I would like to develop an android app for my website and I've no idea how to integrate the komento comment system in my app. I want to display the comments under my articles and it would be good if the users can log on with their accounts and answer on comments.

Until now I've integrated the K2 articles (delivered with JSON) in my app.

Which interface can I use for the comments?

Regards
Hello Denis,

I am sorry but unfortunately we do not have a JSON api in Komento currently
·
Tuesday, 29 July 2014 18:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Okay, thank you for your answer. Is there maybe another way to integrate the komento comments in an app? Is it possible to access the database directly to get the comments and send new comments?
·
Tuesday, 29 July 2014 23:34
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Denis,

Yep, it's definitely possible if you access the database directly
·
Wednesday, 30 July 2014 01:18
·
0 Likes
·
0 Votes
·
0 Comments
·
I looked at it and it could be very exhausting to implement this with accessing the database. Komento has a php api. Is it possible to connect this api with Java?
·
Wednesday, 30 July 2014 22:38
·
0 Likes
·
0 Votes
·
0 Comments
·
I think the best way is for you to access the database because you can't communicate between Java -> PHP unless there is a proxy layer / API and unfortunately we do not have that yet
·
Wednesday, 30 July 2014 23:55
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello again,

in my app I can now authenticate the user and get the user information, by sending the username and password to a login script which is located in the root of my Joomla installation, back (do you think it's okay to do it like this?). The comments of a article I get now over the RSS feed in each article. Now I would like to send a new comment. In which database table I've to send the comment and which attributes do I need to send?

I hope you understand my request. If not, then just ask me.

Regards
·
Wednesday, 13 August 2014 23:36
·
0 Likes
·
0 Votes
·
0 Comments
·
I guess that is the only way for you to transmit data from the server to your app
·
Wednesday, 13 August 2014 23:44
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you for your answer. But I'm not really happy with it. If possible I would prevent a direct access to the database of my Joomla installation. Now I thought about a php script which accesses the komento php api. The app would Post data (article id etc.) to the php script and the script returns the comments of an articles.

Which file do I have to include for the komento php api and would it be the same fast as accessing the database directly?
·
Friday, 15 August 2014 16:49
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Denis,

Like I have posted in my replies above, you need a proxy layer This proxy layer is to retrieve comments form Komento and return it back to the requester with the appropriate json data
·
Friday, 15 August 2014 18:48
·
0 Likes
·
0 Votes
·
0 Comments
·
Which file do I need to include to insert new comments and which data do I have to send?
·
Saturday, 16 August 2014 00:53
·
0 Likes
·
0 Votes
·
0 Comments
·
I am not sure what file are you referring to here but we normally use the table file to store comments. You should refer to the files in /administrator/components/com_komento/tables/

If you want to view the workflow of saving a comment, see /components/com_komento/views/komento/view.ajax.php at the method addComment
·
Saturday, 16 August 2014 01:21
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you very much. That helps me
·
Saturday, 16 August 2014 01:30
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome
·
Saturday, 16 August 2014 15:16
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello again,

I hope this is the last time I'm asking for help. That tip with the view.ajax.php worked perfectly I send the comment data and it adds a new comment to the article. But I can only comment as guest. When I use my login script, Joomla creates a session and the session is available in the database table prefix_session. Now when I comment, it only posts it as guest. Is there any problem with the script or do I need to do something else?

Here is the beginning of my comment script:
<?php
define( '_JEXEC', 1 );
define( 'JPATH_BASE', dirname(__FILE__) );
define( 'JPATH_ROOT', dirname(__FILE__) );
define( 'DS', DIRECTORY_SEPARATOR );

require_once ( JPATH_BASE . DS . 'includes' . DS . 'defines.php' );
require_once ( JPATH_BASE . DS . 'includes' . DS . 'framework.php' );
require ( JPATH_BASE . DS . 'libraries' . DS . 'joomla' . DS . 'factory.php');

$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();

require( JPATH_BASE . DS . 'components' . DS . 'com_komento' . DS . 'constants.php');

class Comment
{
// Here is now a copy of the view.ajax.php
...
?>
·
Monday, 18 August 2014 16:38
·
0 Likes
·
0 Votes
·
0 Comments
·
I don't think there's any way to simulate a session and this really has nothing to do with Komento at all. You just need to ensure that the necessary user session is created.
·
Monday, 18 August 2014 23:10
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post