By Mist on Friday, 20 June 2014
Posted in Technical Issues
Likes 0
Views 1.1K
Votes 0
Hi guys,

We are designing a little different and unique interface for our EasyBlog integration.
We designed the EasBlog frontpage and category pages to show up blog posts in a grid style layout.
We are using Komento integrated with easyblog

At the bottom of each blog item (inside blog.item.php template file) we want to show up some comments related information this way

If there are no comments

{show this}

If there is 1 comment

{show latest comment author avatar}
{output latest comment link}


If there are 2 comments

{show latest 2 comment authors avatars}
{output latest comment link}

If there are 3 comments or more

{show latest 3 comment authors avatars}
{output latest comment link}

See the attachment for an example

I tried to play around inside blog.item.comment.list.php file but i think the template file code applys only to built-in EB comment and does not work for Komento integration, right ?

Any tips on how to achieve what we seek ?
Would love some code example ! Thanks !!!!!!!
Hello Mist,

Please have a look at the attached file.
·
Tuesday, 01 July 2014 13:09
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mist,

I will give you some guides since this is considered as customization is beyond the scope of our support. To get the comments, you can use Komento::getModel('comments')->getComments() which you can see the parameters here in this file: ../components/com_komento/models/comments.php. Same goes to comment count: getTotalComment(); . And you might want to play around with this file: ../components/com_easyblog/themes/default/blog.item.comment.php. Hope this helps.
·
Friday, 20 June 2014 12:37
·
0 Likes
·
0 Votes
·
0 Comments
·
The designer decided that we will drop the bloated stuff so we are going back to basics. Can you help me out with the code needed in order to fully integrate Komento in EasyBlog list pages ?

Komento works fine within blog detail page (blog.read.php) we just want to show in easyblog list pages (blog.latest.php and blog.category.php or it may be within blog.item.php) the following

1. Latest comment user avatar
2. Latest comment link
3. Latest comment username
5. Latest comment date (time ago)

This should work as a default feature within Easyblog integration ... i just need the code to implement it in the list pages. Thanks !
·
Monday, 23 June 2014 06:38
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mist,

I am really sorry but we are actually quite tied up with our own internal development and we wouldn't be able to assist you with these customizations right now If this is a priority, please do post them on our sales section at https://crm.stackideas.com and our sales department would get back to you with a proper quote

Thank you for understanding.
·
Monday, 23 June 2014 10:19
·
0 Likes
·
0 Votes
·
0 Comments
·
I fully understand Nik and don't want to push things to far and take advantage of you guys and your great kindness. I know this is the BEST Joomla support i ever got.
I really appreciate the first tip for that custom need ... but i posted the second one thinking that this should be a part of Komento integration within EasyBlog. It's just basic stuff.

The fact that by default integration only "lives" (was implemented) within easyblog read pages (article detail page) to bare functionality it's a little frustrated since Komento is your guys product and should work awesome integrated with other products from your portofolio.

For example, showing a komento latest comment link, latest comment date (time ago) .... or latest comment user avatar - in easyblog list pages .should be thought from the begining. It's basic stuff.
I am thinking that Komento can be a fully replacement of EasyBlog internal comments system, it's more powerfull .... BUT it should work out of the box the same way the internal easyblog comment system works.

In other words, if i want to output latest comment link in easyblog list page item ... i should be able to do it.
Maybe if you guys didn't thought of this thing (although it's really basic), you should either provide the solution on request or provide some documentation on how to do it ourselves using the "core" easyblog code examples for this.

Example

Komento integration allows this code
<?php echo $row->totalComments; ?>

to work properly for displaying the total comments count from Komento inside EasyBlog list pages (blog.item.php template file).

So this basic "core" code will output the total comments count from Komento without any "advanced magic". The same thing should be available by default for: latest comment link, latest comment date or "time ago", latest comment user name and avatar ... it's just basic stuff.

Having to pay a freelance programmer to make some basic stuff work sometimes is frustrating.

Just my 2 cents. You guys are still great and the products are still awesome.
·
Monday, 23 June 2014 18:14
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mist,

Thanks for your opinion. Really appreciate that. Currently we have stopped development for Komento for a while since we have to focus on Easyblog 4 and Easysocial dev. But don't get me wrong, we are still improving Komento from time to time depends on complaints from our users about bugs, incompatibility and etc. . As for your requirement, I will put this as a feature request for the next major release of Komento. Yes, it is a basic stuff but it still need to discuss the compatibility for both Easyblog and Komento since this will affect the files in Easyblog and there maybe some issues with javascript and others. All these things we need to take into account in adding features. Moreover, next version of Easyblog (Easyblog 4) is using different of files structure. Hence, adding any feature in integration has to put on hold.

Thanks again for your suggestion. Wish we had more users like you. It will help improving our products.
·
Tuesday, 24 June 2014 11:59
·
0 Likes
·
0 Votes
·
0 Comments
·
I am really getting a headache here. I been trying for several hrs to figure things out with no luck.

Can you give me a basic code that would work inside blog.item.php file like this ? (pls pls pls pls )

A. If there are Komento comments for the blog item output this


1. Latest comment username + avatar
2. Latest comment permalink
3. Latest comment date (time ago)

B. If there are no comments, output something else (just dummy text)

I am getting a little bit of frustration here because i spend nights after nights, a lot of hours to make these things to work together.
Our project is getting delayed for really silly and basic stuff.
I can't use the built-in EasyBlog comments because there is no file attachment for comments and Komento, beside file attachment, it seems to be much more powerfull.
I would do it myself but the Komento documentation is a little poor on information and can't seem to figure out how to implement it.

Thanks again !
·
Saturday, 28 June 2014 05:27
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mist,

I've attached a file with the example of code you can follow. Replace it in ../components/com_easyblog/themes/default/blog.item.php. The example code is at the top of the file. Please give it a try. Also, kindly please understand that this is beyond the scope of our support.
·
Monday, 30 June 2014 10:16
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for the code Nik. I managed so far to build that if statement.

I used your code to load Komento model

$komentoModel	= Komento::getModel('comments');
$comment = $komentoModel->getComments('com_easyblog', $row->id);
$count = $komentoModel->getCount('com_easyblog', $row->id);


Then i added the code below to check if comment count is greater than zero and if yes show "this" ... else show "that"

<?php if($count > 0) { ?>

... show this if we have comments

<?php } else { ?>

... show this if we don't have any comments

<?php } ?>


So far all is working perfect. I just need few more information and i promise i won't stress you out anymore on this

1. How to echo the latest comment author name and avatar ?
2. How to echo the latest comment permalink ?
3. How to echo the latest comment "time ago" date ?

That's ALL i need ! and everything is working perfect.
I am keep asking this because it's vital four our EasyBlog functionality. Without it there is no latest comment presence in EasyBlog list pages if using Komento as the comment system. Komento it's not 100% integrated with EasyBlog (it lacks exactly this stuff .. showing latest comment information from Komento in EasyBlog items on list pages)
·
Monday, 30 June 2014 22:57
·
0 Likes
·
0 Votes
·
0 Comments
·
Hooraaay !!! It's alive !
Thanks so much Nik ! I don't have enough words to thank you !
·
Tuesday, 01 July 2014 13:55
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mist,

You're welcome, glad to heard your issues resolved.
·
Tuesday, 01 July 2014 17:27
·
0 Likes
·
0 Votes
·
0 Comments
·
Thx Arlex. Yes, they are pretty much solved.
I am bumping my head how to convert that time to a "time lapse" format (time ago)

This code
<?php echo $commentObj->created; ?>


outputs the date like this: 2014-06-27 18:25:05
and i want it to display the time ago format (X minutes/hours/days/months/years ago)


Here is the entire "call" of Komento, just for the records

$komentoModel	= Komento::getModel('comments');
//$comment = $komentoModel->getComments('com_easyblog', $row->id);
$count = $komentoModel->getCount('com_easyblog', $row->id);
$latestComment = $komentoModel->getLatestComment('com_easyblog', $row->id);
$commentObj = Komento::getComment($latestComment->id);
$latestAuthor = Komento::getProfile( $commentObj->created_by );
// 1. Load article and article details
$application = Komento::loadApplication( 'com_easyblog' )->load( $commentObj->cid );

if( $application === false )
{
$application = Komento::getErrorApplication( 'com_easyblog', $commentObj->cid );
}
// get permalink
$pagelink = $application->getContentPermalink();
$permalink = $pagelink . '#kmt-' . $commentObj->id;


This is how Nik instructed me to load things up.

But i don't want to stress him anymore . He was kind enough for me so far !
I will try to scratch my head into how to achieve the timelapse format for the date.
So, let me get some coffee for another sleepless night
·
Tuesday, 01 July 2014 23:28
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mist,

I'm currently cleaning up our forum (closing threads which were solved etc) and came across this thread of yours. I've noticed that the first inquiry was already solved by my friend Nik. However, you've stated another inquiry in your last post. Do you require our assistance in achieving your preferred results? Let me know if you do and we'll assist you accordingly.
·
Wednesday, 02 July 2014 11:26
·
0 Likes
·
0 Votes
·
0 Comments
·
Sorry for late reply on this Justin. I totally forgot about the topic and i came across my issue today.

The solution above fixed my needs ... the only thing that remains to do is to output the "timeago" format instead of "2014-06-27 18:25:05"

This code (explained above)

<?php echo $commentObj->created; ?>


outputs the date like this "2014-06-27 18:25:05" .. and i just want "timeago" format instead of it. (ex: "2 days ago" )
·
Wednesday, 16 July 2014 05:39
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mist,

Sorry for the late reply. You can use this function:

$commentObj->created = KomentoDateHelper::getLapsedTime( $commentObj->created );


Hope this helps.
·
Wednesday, 16 July 2014 12:15
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks Nik. If i use your code i get errors (white page error)

This is how i implemented

1. First, i loaded the Komento stuff at the beginning of blog.item.php file, like this


$komentoModel = Komento::getModel('comments');
$count = $komentoModel->getCount('com_easyblog', $row->id);
$latestComment = $komentoModel->getLatestComment('com_easyblog', $row->id);
$commentObj = Komento::getComment($latestComment->id);
$commentObj->created = KomentoDateHelper::getLapsedTime( $commentObj->created );
$latestAuthor = Komento::getProfile( $commentObj->created_by );
// 1. Load article and article details
$application = Komento::loadApplication( 'com_easyblog' )->load( $commentObj->cid );

if( $application === false )
{
$application = Komento::getErrorApplication( 'com_easyblog', $commentObj->cid );
}
// get permalink
$pagelink = $application->getContentPermalink();
$permalink = $pagelink . '#kmt-' . $commentObj->id;


then, i inserted the comment date in the same blog.item.php file, a little bit down at the end of the file (in the desired div) like this

<?php echo $commentObj->created; ?>



If i mantain the first code as shown above, i get white page errors

If i will remove your line with the date helper, and use the code below, everything works perfect (except that the date is shown in a different format and not in "timeago" format)


* this code works perfect, the one above throws white page error
$komentoModel	= Komento::getModel('comments');
$count = $komentoModel->getCount('com_easyblog', $row->id);
$latestComment = $komentoModel->getLatestComment('com_easyblog', $row->id);
$commentObj = Komento::getComment($latestComment->id);
$latestAuthor = Komento::getProfile( $commentObj->created_by );
// 1. Load article and article details
$application = Komento::loadApplication( 'com_easyblog' )->load( $commentObj->cid );

if( $application === false )
{
$application = Komento::getErrorApplication( 'com_easyblog', $commentObj->cid );
}
// get permalink
$pagelink = $application->getContentPermalink();
$permalink = $pagelink . '#kmt-' . $commentObj->id;
·
Wednesday, 16 July 2014 18:13
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mist,

Can I have your backend and FTP access so I can check what is the error. Please advise.
·
Thursday, 17 July 2014 10:06
·
0 Likes
·
0 Votes
·
0 Comments
·
We are working on a development server. I will ask my server guy for some access credentials.
Meanwhile, here is our blog.item.php file

The trouble line is the line #12


$commentObj->created = KomentoDateHelper::getLapsedTime( $commentObj->created );


If i keep this line i get white pages error. If i remove it everything works.

PS: Don't mind the extra code, it's just some custom stuff and sql query to our own custom table. Everything works, except that #12 line for time lapsed that will throw white page error.
·
Sunday, 20 July 2014 00:58
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mist,

Sorry for the late reply. Can you use this instead:

$lapsedTime = Komento::getHelper('date')->getLapsedTime( $commentObj->created );
var_dump($lapsedTime);


Hope this helps.
·
Monday, 21 July 2014 09:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Cool, it's working. Thanks for the solution Nik and for this wonderfull support !!!!!
Many thanks. All issues in this topic are solved !!!!
·
Monday, 21 July 2014 18:56
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for updating, glad that your issues are resolved now.
·
Monday, 21 July 2014 23:51
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post