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
(2008-09-17, 07:57 AM)MrDoom Wrote: [ -> ]Like I said before (I think) you'd need to remove the TABLE_PREFIX macro from the database queries.

Ooh, AWESOME. That I didn't try that myself, sorry Blush It works!

Thanks!
One more little question, I have searched and skimmed this thread manually but haven't found any posts about it.

Is it possible to show from which forum name the posts are pulled. Right now I'm pulling the items from two forum id's: 2 and 3 (as explained in your post #89 of this thread).

In my case forum 2 is "News" and forum id 3 is "Articles". What I would like is to add the text "posted in News" or "posted in Articles" after the thread title. So that the titles will look something like:

"Windows XP released posted in News"

and

"Armed Assault review posted in Articles"

So basicly the name of the forum that the post is coming from.

Any suggestions/help is much appreciated Shy
You should be able to use the fid linked to the post to look up the forums table with to get the name. I don't have the database schema in front of me so I can't tell you exactly how though.
(2008-09-17, 06:33 PM)MrDoom Wrote: [ -> ]You should be able to use the fid linked to the post to look up the forums table with to get the name. I don't have the database schema in front of me so I can't tell you exactly how though.
I tried a few things but I'm not sure if I undestand correctly. The forum name is, if I'm correct, located inside the mybb_forums table: 'name'. But I don't know how I can fetch that data because the code is not referring to that part of the database if I'm correct. I mean, I can use {$fid} which posts the forum ID the message is from, but I don't understand how to let the script tell what the name of the forum is.

(sorry, I'm a noob on this matter)
(2008-09-18, 01:26 PM)zoog Wrote: [ -> ]
(2008-09-17, 06:33 PM)MrDoom Wrote: [ -> ]You should be able to use the fid linked to the post to look up the forums table with to get the name. I don't have the database schema in front of me so I can't tell you exactly how though.
I tried a few things but I'm not sure if I undestand correctly. The forum name is, if I'm correct, located inside the mybb_forums table: 'name'. But I don't know how I can fetch that data because the code is not referring to that part of the database if I'm correct. I mean, I can use {$fid} which posts the forum ID the message is from, but I don't understand how to let the script tell what the name of the forum is.

(sorry, I'm a noob on this matter)
For me this question is not necessary anymore so it can be discarded (I don't need the function anymore). Smile Thanks anyway Smile
i get this error Sad
SQL Error: 
1146 - Table 'twospece_mybb2.mybb_mybb_threads' doesn't exist 
Query: 
SELECT * FROM mybb_mybb_threads WHERE fid='2' ORDER BY tid DESC LIMIT 1 

any help ? this is the code in the php Smile

			<?php
    
    $query = $db->simple_select(TABLE_PREFIX.'threads', '*', "fid='{$fid}' ORDER BY tid DESC LIMIT {$limit}");
    if($db->num_rows($query) > 0)
    {
        while($row = $db->fetch_array($query))
        {
            $query2 = $db->simple_select(TABLE_PREFIX.'posts', '*', "pid='{$row['firstpost']}'");
            $row2 = $db->fetch_array($query2);
            
            $date = my_date($mybb->settings['dateformat'], $row2['dateline'], "", 1);
            $time = my_date($mybb->settings['timeformat'], $row2['dateline'], "", 1);

            $options = array(
                            'allow_html' => 'no', 
                            'filter_badwords' => 'yes', 
                            'allow_mycode' => 'yes', 
                            'allow_smilies' => 'yes', 
                            'nl2br' => 'yes', 
                            'me_username' => 'yes'
                            );
            $message = $parser->parse_message($row2['message'], $options);
            
            echo("<a href=\"{$forumpath}showthread.php?tid={$row['tid']}\">{$row['subject']}</a> - 
                Posted: {$date} {$time} by <a href=\"{$forumpath}member.php?action=profile&uid={$row2['uid']}\">{$row2['username']}</a><br />");
            echo("{$message}<br /><br />");
            echo("Replies (<a href=\"{$forumpath}showthread.php?tid={$row['tid']}\">{$row['replies']}</a>)<br /><hr />");
        }
    }
    else
    {
        echo 'Nothing to display.';
    }

?>
its simply the coped and pasted one..

i think the error is coming from the 'twospece_mybb2.mybb_mybb_threads' , it seems to have tomany mybb tables init and just would lke to know how to get ride of it Smile any idea?
Okay i fixed my error , was the simplist thing ever Smile "TABLE_PREFIX." was the problem
For modify this wonderful script for mostrate the recent post or thread in all database?
i see the modify for the or of fid but insert all the fid is a long work...
lol, ok i got it to work but for some reason it keeps saying: Nothing to display.
you do set the fid number.
nice script
i got it to work , but i got 1 question

is there a way to show the latest tread/post that is made on the forum ?? instead of the sub forum ??

what do i mean

i got differend categorys and forums , that makes 1 complete forum

so if a member makes a new tread + post , that it then shows on my homepage
instead of only from 1 forum (let me say that it shows now from forum id 1
but i want it to show from every forum , so if they make a new tread in forum id 2 that it show it to instead of only from forum id 1 )

Greets From The Crasher
For modify this wonderful script for mostrate the recent post or thread in all database?
i see the modify for the or of fid but insert all the fid is a long work...
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