Clan Adverts

Sponsors

CT on Facebook

Latest Product

User Box

Anonymous
38.107.179.220
Nickname:

Password:

Security Code
Security Code
Type Security Code


PND Downloads Feed

Phpnuke Downloads
How to Delete or Reset yo...
How to Delete or Reset your PHPNuke Admin Account
Lost your admin password ?  Cant login to your admin account ? This s...
Back Online & Stuff
Back Online & Stuff
Look at us with our nifty website back up and running… Seriously...
How to edit the admins in...
How to edit the admins in the forums
Here is a way to make someone admin in your forums on your Evo site. I...
Demo Splash Screen
Demo Splash Screen
Ped @ Clan Themes has released a simple splash screen entrance hack. ...
Free Phpnuke Business The...
Free Phpnuke Business Theme 6
This is the 6th Business theme for Phpnuke that Clan Themes has releas...
Tricked Out Slider
Tricked Out Slider
We have seen some great new things come out of Tricked Out News and th...

Custom Work

PHP Nuke Custom Work

www.clanthemes.com :: View topic - Help with code, new forum posts
Help with code, new forum posts

10 Replies / 2504 Views


Post new topic   Reply to topic  

   www.clanthemes.com Forum Index » PHPBB

View previous topic :: View next topic


kardson
Reputation: 0.8 Add RepSubtract Rep
Local time: 2:46 AM
Location: Michigan
usa.gif

Noob
Noob

0.00 posts per day
Medals: 0

Joined: Apr 28, 2008
Last Visit: 07 May 2008
Posts: 7
Points: 100 

Post Help with code, new forum posts Posted: Fri May 02, 2008 1:51 pm

Im having a hard time figuring out how to do the following.

I want to grab the new forum posts and put them in an arrary and then display them.
This I have working, The problem is. I do not want it to show the same topic more than once.
Right now if someone posts 3 times in the same topic, it will show that topic 3 times in the block


Code:
// How many posts to display
$PostNumber = "3";

// How many characters from the title to display (0 = show complete title)
$PostLength = "0";

$query = "SELECT *
        FROM nuke_bbposts, nuke_users, nuke_bbtopics, nuke_bbforums
        WHERE nuke_bbposts.topic_id=nuke_bbtopics.topic_id
        AND nuke_bbposts.forum_id=nuke_bbforums.forum_id
        AND nuke_bbposts.poster_id=nuke_users.user_id
      AND nuke_bbforums.forum_id!=7
        ORDER BY post_time DESC LIMIT $PostNumber";

$content .= "<br>";

$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {

  $topic_title = stripslashes($row[topic_title]);

  if($PostLength){
    $topic_title = substr($topic_title, 0, $PostLength) . "...";
  }

  $content .= "<b>$row[forum_name]</b><br>";
  $content .= "<a title=\"$row[topic_title]\" href=\"$urlPath/viewtopic.php?t=$row[topic_id]&sid=$row[forum_id]\">$topic_title</a>   ";
  $content .= "By: $row[username]<br>";
  $content .= "<br>";

}


Thanks for any help, it is appreciated.
 

 
View user's profileSend private messageVisit poster's websiteAIM AddressYahoo Messenger Reply with quote

Untergang
Reputation: 642.5 Add RepSubtract Rep
votes: 6
Local time: 8:46 AM
Location: Lommel
belgium.gif

Stand-by Stand-by
Stand-by Stand-by

0.19 posts per day
Medals: 0

Joined: May 08, 2007
Last Visit: 31 Oct 2011
Posts: 346
Points: 22131 

Post Re: Help with code, new forum posts Posted: Fri May 02, 2008 6:19 pm

You have to order the wars by topic_last_post_id
So the query becomes like this:
Code:
$query = "SELECT *
        FROM nuke_bbposts, nuke_users, nuke_bbtopics, nuke_bbforums
        WHERE nuke_bbposts.topic_id=nuke_bbtopics.topic_id
        AND nuke_bbposts.forum_id=nuke_bbforums.forum_id
        AND nuke_bbposts.poster_id=nuke_users.user_id
      AND nuke_bbforums.forum_id!=7
        ORDER BY topic_last_post_id DESC LIMIT $PostNumber";
 

UDesigns.be  
View user's profileSend private messageSend e-mailVisit poster's website Reply with quote

kardson
Reputation: 0.8 Add RepSubtract Rep
Local time: 2:46 AM
Location: Michigan
usa.gif

Noob
Noob

0.00 posts per day
Medals: 0

Joined: Apr 28, 2008
Last Visit: 07 May 2008
Posts: 7
Points: 100 

Post Help with code, new forum posts Posted: Fri May 02, 2008 7:50 pm

Doesn't appear to be as simple as that.


It does still list them in order, but it still lists the same topic multiple times if the last posts were on the same topic.

I need to find a way to limit it listing the same forum topic id just once


here the the current code
is there a way to only have it list the most recent post on a forum topic just once within the array.
Or would it be an IF statement before outputting the $content


Code:

// How many posts to display
$PostNumber = "3";

// How many characters from the title to display (0 = show complete title)
$PostLength = "14";

$query = "SELECT *
        FROM nuke_bbposts, nuke_users, nuke_bbtopics, nuke_bbforums
        WHERE nuke_bbposts.topic_id=nuke_bbtopics.topic_id
        AND nuke_bbposts.forum_id=nuke_bbforums.forum_id
        AND nuke_bbposts.poster_id=nuke_users.user_id
      AND nuke_bbforums.forum_id!=7
        ORDER BY topic_last_post_id DESC LIMIT $PostNumber";

$content .= "<br>";

$result = mysql_query($query);
while($row = mysql_fetch_array($result)) {

  $topic_title = stripslashes($row[topic_title]);

  if($PostLength){
    $topic_title = substr($topic_title, 0, $PostLength) . "...";
  }

  $content .= "<b>$row[forum_name]</b><br>";
  $content .= "<a title=\"$row[topic_title]\" href=\"$urlPath&file=viewtopic&t=$row[topic_id]&sid=$row[forum_id]\">$topic_title</a>   ";
  $content .= "By: $row[username]<br>";
  $content .= "<br>";

}
 

 
View user's profileSend private messageVisit poster's websiteAIM AddressYahoo Messenger Reply with quote


DreAdeDcoRpSE
Reputation: 2572.3 Add RepSubtract Rep
votes: 28
Local time: 2:46 AM
Location: Back of your Mind
usa.gif

Site Admin
Site Admin

1.37 posts per day
Medals: 3 (View more...)
Dedication (Amount: 1)
Forums Moderator
Forums Moderator
Joined: Sep 22, 2007
Last Visit: 24 May 2012
Posts: 2331
Points: 136106 

Post Help with code, new forum posts Posted: Fri May 02, 2008 8:31 pm

Shop Purchases:
Enemy Territory Theme (Aviator) for PHP Nuke · Clan Roster 2.0 ·  · Modern Warfare 3 Xtreme Theme

I am a little lost on what you are trying to do, are you trying to create a block to display the last few post that were made?

Or trying to add it to the forums?
 

 
View user's profileSend private messageVisit poster's website Reply with quote

kardson
Reputation: 0.8 Add RepSubtract Rep
Local time: 2:46 AM
Location: Michigan
usa.gif

Noob
Noob

0.00 posts per day
Medals: 0

Joined: Apr 28, 2008
Last Visit: 07 May 2008
Posts: 7
Points: 100 

Post Help with code, new forum posts Posted: Fri May 02, 2008 8:39 pm

It's for a block on my main page of the phpnuke site.
Such that it displays the most recent posts from the forums module.
But I do not want it to display the same topic twice, if those are the last 2 posts.

So the Block Looks like

Topic 1
Topic 2
Topic 3

not like

Topic 1
Topic 2
Topic 1

or

Topic 2
Topic 2
Topic 1

So I need to find a way to remove all but the most recent instance of each Forum Topic, and im not quite sure how to pull that off.
 

 
View user's profileSend private messageVisit poster's websiteAIM AddressYahoo Messenger Reply with quote

DreAdeDcoRpSE
Reputation: 2572.3 Add RepSubtract Rep
votes: 28
Local time: 2:46 AM
Location: Back of your Mind
usa.gif

Site Admin
Site Admin

1.37 posts per day
Medals: 3 (View more...)
Super Dedicated User (Amount: 1)
Forums Moderator
Forums Moderator
Joined: Sep 22, 2007
Last Visit: 24 May 2012
Posts: 2331
Points: 136106 

Post Help with code, new forum posts Posted: Fri May 02, 2008 11:23 pm

Shop Purchases:
Enemy Territory Theme (Aviator) for PHP Nuke · Clan Roster 2.0 ·  · Modern Warfare 3 Xtreme Theme

I do have a block that will display that last 5 post of your forums on your main page if you want it. You can see it working on my site.

Click my banner to see it.
 

 
View user's profileSend private messageVisit poster's website Reply with quote


Untergang
Reputation: 642.5 Add RepSubtract Rep
votes: 6
Local time: 8:46 AM
Location: Lommel
belgium.gif

Stand-by Stand-by
Stand-by Stand-by

0.19 posts per day
Medals: 0

Joined: May 08, 2007
Last Visit: 31 Oct 2011
Posts: 346
Points: 22131 

Post Re: Help with code, new forum posts Posted: Sat May 03, 2008 9:07 am

Try this one
This one should work
Code:
$query = "SELECT *  FROM nuke_bbtopics ORDER BY topic_last_post_id DESC LIMIT 0,$PostNumber";
 

 
View user's profileSend private messageSend e-mailVisit poster's website Reply with quote

mia_undertaker
Reputation: 461.4 Add RepSubtract Rep
Local time: 2:46 AM

blank.gif

Tree Hugger
Tree Hugger

0.04 posts per day
Medals: 0

Joined: Jun 03, 2007
Last Visit: 28 Feb 2011
Posts: 72
Points: 9879 

Post Help with code, new forum posts Posted: Sat May 03, 2008 10:08 am

Shop Purchases:
Clan Roster v1.7 Php Nuke Module · Clan Roster 2.0 · Modern Gamer Multi Theme · Gamer Cards Module

I think you could also use this:

Code:
$query = "SELECT *
        FROM nuke_bbposts, nuke_users, nuke_bbtopics, nuke_bbforums
        WHERE nuke_bbposts.topic_id=nuke_bbtopics.topic_id
        AND nuke_bbposts.forum_id=nuke_bbforums.forum_id
        AND nuke_bbposts.poster_id=nuke_users.user_id
      AND nuke_bbforums.forum_id!=7
        GROUP BY topic_last_post_id DESC LIMIT $PostNumber";


Then it will only give you one topic.

[MIA] UnderTaker
www.MIAClan.net
 

 
View user's profileSend private message Reply with quote

DreAdeDcoRpSE
Reputation: 2572.3 Add RepSubtract Rep
votes: 28
Local time: 2:46 AM
Location: Back of your Mind
usa.gif

Site Admin
Site Admin

1.37 posts per day
Medals: 3 (View more...)
Dedication (Amount: 1)
Forums Moderator
Forums Moderator
Joined: Sep 22, 2007
Last Visit: 24 May 2012
Posts: 2331
Points: 136106 

Post Help with code, new forum posts Posted: Sat May 03, 2008 12:12 pm

Shop Purchases:
Enemy Territory Theme (Aviator) for PHP Nuke · Clan Roster 2.0 ·  · Modern Warfare 3 Xtreme Theme

Or you can just use this block in this post.

http://www.clan-themes.co.uk/ftopict-3547.html

Retard Retard Retard
 

 
View user's profileSend private messageVisit poster's website Reply with quote


mia_undertaker
Reputation: 461.4 Add RepSubtract Rep
Local time: 2:46 AM

blank.gif

Tree Hugger
Tree Hugger

0.04 posts per day
Medals: 0

Joined: Jun 03, 2007
Last Visit: 28 Feb 2011
Posts: 72
Points: 9879 

Post Help with code, new forum posts Posted: Sat May 03, 2008 7:11 pm

Shop Purchases:
Clan Roster v1.7 Php Nuke Module · Clan Roster 2.0 · Modern Gamer Multi Theme · Gamer Cards Module

LOL. That would always be an option.

I am using the advanced forum block myself.

UnderTaker
www.MIAClan.net
 

 
View user's profileSend private message Reply with quote

DreAdeDcoRpSE
Reputation: 2572.3 Add RepSubtract Rep
votes: 28
Local time: 2:46 AM
Location: Back of your Mind
usa.gif

Site Admin
Site Admin

1.37 posts per day
Medals: 3 (View more...)
Super Dedicated User (Amount: 1)
Forums Moderator
Forums Moderator
Joined: Sep 22, 2007
Last Visit: 24 May 2012
Posts: 2331
Points: 136106 

Post Help with code, new forum posts Posted: Sun May 04, 2008 7:09 am

Shop Purchases:
Enemy Territory Theme (Aviator) for PHP Nuke · Clan Roster 2.0 ·  · Modern Warfare 3 Xtreme Theme

Both of them work great, I just upgraded mine a few days ago.
 

 
View user's profileSend private messageVisit poster's website Reply with quote
Post new topic   Reply to topic  
   www.clanthemes.com Forum Index » PHPBB


 
10 Replies / 2504 Views
Page 1 of 1
All times are GMT
Display posts from previous:   
 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum