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 tried add this to onlinetv.php

but i got this : Parse error: parse error, expecting T_STRING' orT_VARIABLE' or `T_NUM_STRING' in C:\xampp\htdocs\onlinetv.php(8) : eval()'d code on line 33

any help?
could you paste your code?
<?php

    $fid = 9;
    $limit = 5;
    $forumpath = '/';

    chdir($forumpath);
    define("IN_MYBB", 1);
    require('./global.php');
    require_once MYBB_ROOT."inc/class_parser.php";
    $parser = new postParser;
    chdir('../');
?>

<?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.';
    }

?>


SmileSmile
replace your inc/class_parser file with this one http://community.mybboard.net/thread-42815.html
still not work,

Parse error: parse error, expecting T_STRING' orT_VARIABLE' or `T_NUM_STRING' in C:\xampp\htdocs\youtube.php(8) : eval()'d code on line 60

line 8 :
 define("IN_MYBB", 1);

and line 60 is :
$query2 = $db->simple_select(TABLE_PREFIX.'posts', '*', "pid='{$row['firstpost']}'");

help please Smile
do you use mybb 1.4? if so:

$query2 = $db->simple_select('posts', '*', "pid='{$row['firstpost']}'");

and:

$query = $db->simple_select('threads', '*', "fid='{$fid}' ORDER BY tid DESC LIMIT {$limit}");
If you upload class_parser file in .inc/ forlder .... It should worked ..... Please check again
Do attachments work or even img tags im wanting to use this as a mini gallery
Anyone knows what I should change in the code in order to display only one specific post (id)? Smile
change:

$query = $db->simple_select(TABLE_PREFIX.'threads', '*', "fid='{$fid}' ORDER BY tid DESC LIMIT {$limit}");

into:

$query = $db->simple_select(TABLE_PREFIX.'threads', '*', "fid='{$fid}' AND tid='your treadid' ORDER BY tid DESC LIMIT {$limit}");
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