Facebook 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4292
Latest: MashaMl8417
New This Month: 4
New This Week: 3
New Today: 3
Stats
Total Posts: 43790
Total Topics: 7602
Most Online Today: 62
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 46
Total: 46

Author Topic: Recent Comments in a portal block  (Read 5754 times)

0 Members and 1 Guest are viewing this topic.

Offline cosmicx

  • Full Member
  • ***
  • Posts: 108
    • View Profile
    • Baguio Ads | Baguio City Online Classifieds Ads
Recent Comments in a portal block
« on: September 01, 2011, 09:41:54 am »
how to accomplish this? i have adkportal in my dev site

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16673
    • View Profile
Re: Recent Comments in a portal block
« Reply #1 on: September 02, 2011, 08:58:47 am »
Would need to write a query to get all recent comments from listings that are not removed and then have it displayed it would be php code.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline cosmicx

  • Full Member
  • ***
  • Posts: 108
    • View Profile
    • Baguio Ads | Baguio City Online Classifieds Ads
Re: Recent Comments in a portal block
« Reply #2 on: September 03, 2011, 05:04:14 am »
i have no idea how to do that? any instructions in English? don't know sql and php.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16673
    • View Profile
Re: Recent Comments in a portal block
« Reply #3 on: September 06, 2011, 07:03:02 pm »
Example code:
Code: [Select]
global $smcFunc;
  $dbresult = $smcFunc['db_query']('', "
  SELECT
  c.ID_COMMENT, c.ID_LISTING, c.comment, c.date, c.ID_MEMBER, m.member_name,
  m.real_name FROM {db_prefix}class_comment as c
  LEFT JOIN {db_prefix}members AS m ON (c.ID_MEMBER = m.ID_MEMBER)
  WHERE c.approved = 1 ORDER BY c.ID_COMMENT DESC LIMIT 10");
while($row = $smcFunc['db_fetch_assoc']($dbresult))
{

echo '<a href="' . $scripturl . '?action=classifieds;sa=view;id=' . $row['ID_LISTING'] . '">' . substr($row['comment'], 0, 100)  .'</a><br />
by ';

if($row['real_name'] != '')
echo '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">'  . $row['real_name'] . '</a>';
else
echo ''  . $txt['class_guest']. '';
echo '<br />
', timeformat($row['date']), '
<hr /><br />';


}
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline cosmicx

  • Full Member
  • ***
  • Posts: 108
    • View Profile
    • Baguio Ads | Baguio City Online Classifieds Ads
Re: Recent Comments in a portal block
« Reply #4 on: September 07, 2011, 04:17:00 am »
thank you for the respond....


i've tried the code, it only displays the comment and the one who give the comment and the date. In the original  comment block, it shows the Category and the Listing title.

In my case, I only want to display the Listings title. I hope you may help me further.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16673
    • View Profile
Re: Recent Comments in a portal block
« Reply #5 on: September 07, 2011, 08:00:28 am »
Try
Code: [Select]
<?php

global $smcFunc;
   $dbresult $smcFunc['db_query'](''"
   SELECT 
   c.ID_COMMENT, c.ID_LISTING, c.comment, c.date, c.ID_MEMBER, l.title
    FROM {db_prefix}class_comment as c, {db_prefix}class_listing as l

   WHERE l.ID_LISTING = c.ID_LISTING AND c.approved = 1 ORDER BY c.ID_COMMENT DESC LIMIT 10"
);
while($row $smcFunc['db_fetch_assoc']($dbresult))
{

echo '<a href="' $scripturl '?action=classifieds;sa=view;id=' $row['ID_LISTING'] . '">' substr($row['title'], 0100)  .'</a><br />';


}
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline cosmicx

  • Full Member
  • ***
  • Posts: 108
    • View Profile
    • Baguio Ads | Baguio City Online Classifieds Ads
Re: Recent Comments in a portal block
« Reply #6 on: September 08, 2011, 09:31:23 pm »
thank you so much for this.... more power smfhacks..

Offline cosmicx

  • Full Member
  • ***
  • Posts: 108
    • View Profile
    • Baguio Ads | Baguio City Online Classifieds Ads
Re: Recent Comments in a portal block
« Reply #7 on: September 25, 2011, 11:35:12 am »
hello again... i've been struggling to put this code in a 2 row table.


what i want to accomplish is... display 20 recent comments... 10 in each row... im just learning about basic tables right now.

i don't know yet, how to incorporate it with php and sql. i hope you may help.

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
3805 Views
Last post May 13, 2009, 03:18:58 pm
by propyl
1 Replies
5279 Views
Last post June 08, 2010, 03:18:26 pm
by SMFHacks
1 Replies
3199 Views
Last post October 16, 2011, 03:01:51 pm
by SMFHacks
9 Replies
2948 Views
Last post August 23, 2022, 12:42:22 pm
by SMFHacks
9 Replies
2170 Views
Last post April 05, 2022, 01:29:19 pm
by SMFHacks

+- Recent Topics

[Mod]Cloudflare Turnstile for SMF by SMFHacks
May 08, 2025, 10:08:43 am

Disable "Notify me of Comments feature" by Kiwi
May 08, 2025, 02:04:16 am

Trying to access array offset on null by Michel68
May 05, 2025, 08:47:34 am

Default [Additional] Membergroups upon Registration by SMFHacks
April 30, 2025, 10:22:52 am

Sorted FTP Import Directory by SMFHacks
April 25, 2025, 05:11:22 am

Search results items per page? by SMFHacks
April 18, 2025, 04:12:23 pm

Suggestions and request by Senkusha
April 03, 2025, 02:30:43 pm

How does a member add a Classified Listing? by SMFHacks
March 28, 2025, 08:05:50 pm

Auto converting to webp or AVIF by [chrisB]
March 28, 2025, 01:46:00 pm

Thumbnail creation settings by SMFHacks
March 28, 2025, 12:42:51 pm

Powered by EzPortal