Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 12367
Latest: tech9
New This Month: 7
New This Week: 0
New Today: 0
Stats
Total Posts: 40205
Total Topics: 7079
Most Online Today: 55
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 36
Total: 36

Author Topic: Recent Comments in a portal block  (Read 3425 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: 15103
    • 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: 15103
    • 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: 15103
    • 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
2360 Views
Last post May 13, 2009, 03:18:58 pm
by propyl
2 Replies
4765 Views
Last post April 01, 2010, 07:39:09 am
by Pegasys
1 Replies
3318 Views
Last post June 08, 2010, 03:18:26 pm
by SMFHacks
1 Replies
1569 Views
Last post October 16, 2011, 03:01:51 pm
by SMFHacks
0 Replies
1155 Views
Last post October 15, 2015, 07:42:27 pm
by shuban

+- Recent Topics

Error message with latest SMF 2.1 Github build by Hatshepsut
May 25, 2020, 01:43:26 am

smfblog not working on 2.0.17 by tech9
May 20, 2020, 01:44:34 pm

Copyright removal by stbc
May 18, 2020, 01:27:57 am

Mod Verified User i can't square the image by Rock Lee
May 07, 2020, 07:56:10 pm

SMF4Mobile 2.0 released for SMF 2.0.x by SMFHacks
May 06, 2020, 12:13:14 pm

SMF Social Login Pro - Discontinued? by Nicole
May 02, 2020, 05:47:04 pm

Likes by SMFHacks
April 30, 2020, 09:50:35 pm

Upgrade Issue - by SMFHacks
April 28, 2020, 12:40:13 pm

Issues regarding Licenses and Domain by SMFHacks
April 28, 2020, 10:59:41 am

[Mod]SMF2WPBridge - Wordpress Login Bridge by js
April 28, 2020, 05:04:54 am

Powered by EzPortal