Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4257
Latest: Alex998.
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 43293
Total Topics: 7522
Most Online Today: 96
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 91
Total: 91

Author Topic: Recent Comments in a portal block  (Read 5445 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: 16451
    • 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: 16451
    • 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: 16451
    • 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
3673 Views
Last post May 13, 2009, 03:18:58 pm
by propyl
1 Replies
5052 Views
Last post June 08, 2010, 03:18:26 pm
by SMFHacks
1 Replies
2927 Views
Last post October 16, 2011, 03:01:51 pm
by SMFHacks
9 Replies
2198 Views
Last post August 23, 2022, 12:42:22 pm
by SMFHacks
9 Replies
1596 Views
Last post April 05, 2022, 01:29:19 pm
by SMFHacks

+- Recent Topics

Rate own images by fvlog19
April 11, 2024, 10:56:53 am

Tidy Child Boards on 2.1.4 by SMFHacks
April 04, 2024, 03:54:12 pm

Problems SMF 2.0.19 > 2.1.4 SMF Gallery Pro - Recents Images to overall header by Michel68
March 30, 2024, 12:41:08 pm

Can't DROP 'id_member'; check that column/key exists Datei: by SMFHacks
March 30, 2024, 11:58:20 am

No thumbnails on new uploads by Tonyvic
March 29, 2024, 06:26:18 am

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

an idea for new mod (( content type with different display )) by SMFHacks
February 27, 2024, 01:36:27 pm

Powered by EzPortal