MyBB Community Forums

Full Version: Displaying News on your homepage
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
I sent you a pm Smile thanks for helping

The news output which is being outputted wrong is entitled :

"Homer Simpsons quote(speech) machine 0.7"

Which rather than showing the first post (and thread creators name) its showing my name and my reply to his thread.

Seems pretty bizarre but im wondering if that could be caused by our recent server change? All the news posts where made on the old server you see, we have only just moved to a new one.

Thanks again
That's certainly strange. Could you reply to one of the other posts on that page to see if the bug is persistent? (I can't tell since no others have replies) and then if it still happens there could you please PM me the code you use to output the news since this doesn't happen on my testing server using the code from the first page.

If it doesn't replicate, then I have no idea what would cause it to happen to a single post.
sure il pm you the whole source code.

could it be due to the server change perhaps?
Ok, try changing:
$query2 = $db->simple_select(TABLE_PREFIX.'posts', '*', "tid='{$row['tid'] }' LIMIT 1");
To:
$query2 = $db->simple_select(TABLE_PREFIX.'posts', '*', "pid='{$row['firstpost']}'");
Brilliant Big Grin that fixed up brilliantly. Thank you very much Smile

While i have your attention i have one more small question.

I was browsing through portal.php and failed to find the part which outputs the selected icon for the news...I also searched through the templates and couldnt find anything relevant.

Any hints ? Big Grin

And thanks again for your fast response Smile
If you want to add the post icon, after:
$row2 = $db->fetch_array($query2);
Add this code:
$query3 = $db->simple_select(TABLE_PREFIX.'icons', '*', "iid='{$row['icon']}'");
$row3 = $db->fetch_array($query3);

And then add this code where you want the image to be displayed:
if($row['icon'] != 0)
{
	echo("<img src=\"{$forumpath}{$row3['path']}\" alt=\"{$row3['name']}\" /> ");
}
That works perfectly tooSmile

Thank you so much for all your help Big Grin
is there any way of having multiple Fid's with this (ie - showing news from multiple forums)

I tried changing the : $fid = 6; line into an array but i got no news ouput after doing so.

Thanks Smile
I haven't tested this (and if it works, this is the lazy way to do it) but try this as your first query:
$query = $db->simple_select(TABLE_PREFIX.'threads', '*', "fid='YOUR FIRST FID' OR fid='YOUR SECOND FID' ORDER BY tid DESC LIMIT {$limit}");

Try replacing your FIDs in that where it says "YOUR FIRST FID", "YOUR SECOND FID". You should be able to just add as many FIDs as your like by adding "OR fid='YOUR FID'" for each one.
yep that works Smile

Cheers Big Grin
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33