SMFHacks.com
** Home Forum Index Hacks Products Login Register Search
Welcome, Guest. Please login or register.
May 23, 2012, 05:42:14 am

Login with username, password and session length
Members
Total Members: 10069
Latest: tetsujrock
Stats
Total Posts: 28682
Total Topics: 4975
Online Today: 94
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 0
Guests: 72
Total: 72
+ 
|-+ 
| |-+ 
| | |-+ 
| | | |-+ 
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 3 4 Go Down Print
Author Topic: Latest comments  (Read 13901 times)
smartmouse
Newbie
*
Offline Offline

Posts: 21


View Profile
« on: January 15, 2008, 12:26:01 am »

Hello, any way to create a tp module that shows latest comments added?

Thank you.
Logged
smartmouse
Newbie
*
Offline Offline

Posts: 21


View Profile
« Reply #1 on: January 15, 2008, 02:57:06 pm »

Is it possible to do it?
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 9676


View Profile
« Reply #2 on: January 15, 2008, 07:58:32 pm »

Yes it is would require checking the gallery comments table with a database query
Logged
smartmouse
Newbie
*
Offline Offline

Posts: 21


View Profile
« Reply #3 on: January 16, 2008, 07:52:20 am »

I can't do it... is it easy for you create that query?
Logged
smartmouse
Newbie
*
Offline Offline

Posts: 21


View Profile
« Reply #4 on: January 17, 2008, 10:57:44 am »

Please some one can help me to create a php module that show latest comments?
Logged
rumboogy
SMF Gallery Pro Customer
Full Member
*****
Offline Offline

Posts: 215


View Profile WWW
« Reply #5 on: January 17, 2008, 12:23:48 pm »

I like that idea...but unfortunately it would take more expertise than I have...interesting though...I will watch this thread. You could also check over at the TP Site.

Wally
« Last Edit: January 17, 2008, 12:25:59 pm by rumboogy » Logged

Rumboogy
"Yeah, I got way too many irons in the fire"
Biker Site:      http://www.razorbiker.com
Biker Site:      http://www.arkansasbiker.net
Zumo GPS:     http://www.zumoforums.com
Personal Site:  http://www.wallyjarratt.com
smartmouse
Newbie
*
Offline Offline

Posts: 21


View Profile
« Reply #6 on: January 18, 2008, 05:56:26 am »

@admin: can you create a module like this?

http://www.smfhacks.com/index.php/topic,125.msg8845.html#msg8845

I think you can modify it to make it showing latest comments instead of random images.
Am i right or maybe it is more difficult than i think?

I hope can do it.

Thank you.
Logged
smartmouse
Newbie
*
Offline Offline

Posts: 21


View Profile
« Reply #7 on: January 20, 2008, 05:47:23 pm »

Anyone (maybe a programmer) can help me?
Logged
smartmouse
Newbie
*
Offline Offline

Posts: 21


View Profile
« Reply #8 on: March 10, 2008, 10:20:13 am »

I'm here again!

I tried my best to write this:

Code:
function ssi_lastcom ($cat)
{
global $scripturl,$db_prefix;
$cat = (int) $cat;

$request = db_query("SELECT comment, date, ID_MEMBER, ID_PICTURE FROM {$db_prefix}gallery_comment GROUP BY comment ORDER BY date DESC LIMIT 5", __FILE__, __LINE__);
$row = mysql_fetch_assoc($request);
mysql_free_result($request);
echo' <a href="', $scripturl, '?action=gallery;sa=view;id=', $row['ID_PICTURE'], '"><small>', $row['comment'], '</small></a><br />Written by: <strong>', $row['ID_MEMBER'],  ' '
;}

It works, but it shows only 1 comment...
So, do you know how to make it to show more than 1 comment? I write LIMIT 5 but it does not work!
In addition, do you know how to show member name instead of member id ?
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 9676


View Profile
« Reply #9 on: March 10, 2008, 07:29:55 pm »

Try this
Code:
function ssi_lastcom ($cat)
{
global $scripturl,$db_prefix;
$cat = (int) $cat;

$request = db_query("SELECT comment, date, ID_MEMBER, ID_PICTURE FROM {$db_prefix}gallery_comment ORDER BY date DESC LIMIT 5", __FILE__, __LINE__);
while($row = mysql_fetch_assoc($request))
      {
echo' <a href="', $scripturl, '?action=gallery;sa=view;id=', $row['ID_PICTURE'], '"><small>', $row['comment'], '</small></a><br />Written by: <strong>', $row['ID_MEMBER'];
       }
mysql_free_result($request);

}
« Last Edit: March 10, 2008, 08:09:12 pm by SMFHacks » Logged
rumboogy
SMF Gallery Pro Customer
Full Member
*****
Offline Offline

Posts: 215


View Profile WWW
« Reply #10 on: March 10, 2008, 07:51:26 pm »

I tried smartmouse's code and got no errors, but I also got no comment.

I tried Mr. Hacks code...and got the same thing. Just curious...and you may or may not want to develop this or work on it...but to me it seems like it would have more meaning if the block ALSO included the image that was being commented on...

Thanks.

Wally
Logged

Rumboogy
"Yeah, I got way too many irons in the fire"
Biker Site:      http://www.razorbiker.com
Biker Site:      http://www.arkansasbiker.net
Zumo GPS:     http://www.zumoforums.com
Personal Site:  http://www.wallyjarratt.com
smartmouse
Newbie
*
Offline Offline

Posts: 21


View Profile
« Reply #11 on: March 11, 2008, 08:49:35 am »

My friend help me and now it works. Here is the working code:

Code:
function ssi_lastcom ($cat)
{
global $scripturl,$db_prefix;
$cat = (int) $cat;
 
$request = db_query("SELECT comment, date, ID_MEMBER, ID_PICTURE FROM {$db_prefix}gallery_comment GROUP BY comment ORDER BY date DESC LIMIT 5", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request)) {
echo' <a href="', $scripturl, '?action=gallery;sa=view;id=', $row['ID_PICTURE'], '"><small>', $row['comment'], '</a><br />Scritto da: <strong>', $row['ID_MEMBER'],  '<br /><br /></strong></small> ';
}
mysql_free_result($request);
}

Now i have to fix just the last thing: how to show member name instead of member id?
It results in messages like "Hello world" written by: 2, instead of "Hello world" written by: John.

Do you understand what i mean? How to fix it?
Logged
smartmouse
Newbie
*
Offline Offline

Posts: 21


View Profile
« Reply #12 on: March 11, 2008, 08:51:56 am »

Ehm.. it is the same code posted by SMFHacks.
Anyway how to fix my problem?
Logged
rumboogy
SMF Gallery Pro Customer
Full Member
*****
Offline Offline

Posts: 215


View Profile WWW
« Reply #13 on: March 11, 2008, 10:32:57 am »

Ehm.. it is the same code posted by SMFHacks.
Anyway how to fix my problem?

Smartmouse...I only get a blank block with your new code.

Also...don't you think the block should also include the image with the last comment?  yes, no?

Maybe I am missing something, the function ssi_lastcom ($cat)...is that something that should be in my SSI.php file?

Wally
Logged

Rumboogy
"Yeah, I got way too many irons in the fire"
Biker Site:      http://www.razorbiker.com
Biker Site:      http://www.arkansasbiker.net
Zumo GPS:     http://www.zumoforums.com
Personal Site:  http://www.wallyjarratt.com
smartmouse
Newbie
*
Offline Offline

Posts: 21


View Profile
« Reply #14 on: March 11, 2008, 12:33:04 pm »

I added the code that i posted above at the end of SSI.php file.
Then i create a new block in TPortal and i added the following code:

Code:
ssi_lastcom();

It works.
Logged
Pages: [1] 2 3 4 Go Up Print 
« previous next »
Jump to:  

Recent
[May 21, 2012, 08:54:11 am]

[May 20, 2012, 11:06:52 am]

[May 20, 2012, 05:58:11 am]

[May 19, 2012, 06:16:58 pm]

[May 19, 2012, 05:42:37 pm]

[May 18, 2012, 03:08:38 pm]

[May 17, 2012, 06:07:46 pm]

[May 17, 2012, 02:22:07 pm]

[May 17, 2012, 12:38:16 pm]

[May 15, 2012, 09:32:27 pm]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Powered by SMF 1.1.16 | SMF © 2006-2011, Simple Machines LLC
TinyPortal v0.9.7 © Bloc
SMF and SimpleMachines are registered trademarks of Simple Machines. SMFHacks.com is not affiliated with nor endorsed by Simple Machines.
Page created in 0.282 seconds with 20 queries.