1 (edited by Tubby 2006-07-16 07:08)

Topic: Index Problem

Hey im currently running one of the portal modifications and i modified a bit.

This is the error im getting:  Parse error: syntax error, unexpected '<' in /home/fatalgam/public_html/fatal-gfx/index.php on line 20

Its telling me on line 20 so i decided to count the lines using different methods and i found that the error must be in between the lines of this code somewhere.

I still cant seemto find anything wrong.

 <div class="blockmenu" style="float:left;width:180px">
    <br />
    <h2><span>Navigation</span></h2>
    <div class="box">
        <div class="inbox">

I cant seem to find the error. Could any of you possibly try to find it for me. I know its not the code i added in it has to be part of some code i deleted in the beginning of the file.

Heres my whole file.

<?php
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';


// Load all the language files
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';
require PUN_ROOT.'include/parser.php'; 

$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';

$newsid = '1'; //This is the forum the news is retrieved from
$newsdisplay = '3'; //This is how many news articles are displayed.

<div id="portalconsole" class="block2col">
    <div class="blockmenu" style="float:left;width:180px">
    <br />
    <h2><span>Navigation</span></h2>
    <div class="box">
        <div class="inbox">
        <ul>
<?
        $links = array();
        $links[] = '<a href="forums.php">'.$lang_common['Forums'].'</a>';
        $links[] = '<a href="userlist.php">'.$lang_common['User list'].'</a>';
        
        if ($pun_user['g_id'] < PUN_GUEST)
            $links[] = ' <a href="search.php">'.$lang_common['Search'].'</a>';
        
        if ($pun_user['is_guest'])
        {
            $links[] = ' <a href="register.php">'.$lang_common['Register'].'</a>';
            $links[] = '- <a href="login.php">'.$lang_common['Login'].'</a>';
        }
        else
        {
            $links[] = ' <a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>';
            
            if ($pun_user['g_id'] < PUN_GUEST)
                $links[] = ' <a href="admin_index.php">'.$lang_common['Admin'].'</a>';
            
            $links[] = ' <a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
        }
            foreach($links as $link)
                echo "\t\t\t\t\t".$link.'<br />'."\n";
?>
        </ul>
        </div>
    </div>
<br />
<?php
if ($pun_user['is_guest'])
{
?>
<h2><span><?php echo $lang_common['Login'] ?></span></h2>
<div class="box">
    <div class="inbox" style="text-align: center">
        <form id="login" method="post" action="login.php?action=in" onsubmit="return process_form(this)">
            <div class="inform">
                <input type="hidden" name="form_sent" value="1" />
                <input type="hidden" name="redirect_url" value="index.php" />
                <label><strong><?php echo $lang_common['Username']?></strong><br /><input type="text" name="req_username" size="16" maxlength="25" tabindex="1" /> <br /></label>
                <label><strong><?php echo $lang_common['Password']?></strong><br /><input type="password" name="req_password" size="16" tabindex="2" /><br /></label>
                <p><a href="login.php?action=forget" tabindex="5"><?php echo $lang_login['Forgotten pass'] ?></a></p>
                <input type="submit" name="login" value="<?php echo $lang_common['Login'] ?>" tabindex="3" />
            </div>
        </form>
    </div>
</div>
<?
} else if (!$pun_user['is_guest'])
{
?>
    <h2><span>Affliates</span></h2>
        <div class="box">
            <div class="inbox">
                <ul>
<li><a href="http://www.opti-net.org"><strong>Opti-Net</strong></a></li>
</ul>
            </div>
        </div>
<?
}
?>
</div>
</div>
<div class="blockform" style="margin-left: 190px;margin-right: 5px;">
        <h2><span>Latest News</span></h2>
        <div class="box">
            <div class="inbox">
                <table>
                    <tr>
                        <td>
                            <?
                                $result = $db->query('SELECT t.id, t.subject, t.forum_id, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted, g.g_title, g.g_color, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.topic_id=t.id AND p.posted=t.posted INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE t.forum_id='.$newsid.' AND t.moved_to IS NULL AND f.redirect_url IS NULL ORDER BY t.posted DESC LIMIT '.$newsdisplay) or error('Unable to fetch announcements', __FILE__, __LINE__, $db->error());


                    
                    if ($db->num_rows($result))
                    {
                            while($cur_post = $db->fetch_assoc($result))
                            {
                                    $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
                                echo "\t\t\t\t\t\t\t".'<p><strong><a href="viewforum.php?id='.$cur_post['forum_id'].'">'.pun_htmlspecialchars($cur_post['forum_name']).'</a> » <a href="viewtopic.php?id='.$cur_post['id'].'">'.pun_htmlspecialchars($cur_post['subject']).'</a></strong><strong> » </strong><strong>Posted By </strong><a href="profile.php?id='.$cur_post['poster_id'].'" class="username"><strong><span style="color: '.$cur_post['g_color'].'">'.pun_htmlspecialchars($cur_post['poster']).'</a></span></strong></p>'."\n";
?>
</br>
                                <div class="postmsg">
                                    <?php echo $cur_post['message']."\n" ?>
                                </div>
                                <br />
                                
                            <br />
                            <?
                            }
                        }
                        else
                        {
                            echo 'No news';
                        }    
                            ?>                    
                        </td>
                    </tr>
                </table>                          
            </div>
        </div>
    <div class="clearer"></div>    
</div>

<?php
$footer_style = 'index';
require PUN_ROOT.'footer.php';
?>

2

Re: Index Problem

nevermind dont reply to this topic the error has been resolved. I had forgotten to close the beginning php tag with a "?>". Stupid me tongue if you look inside the code you will notice that i had forgotten the closing tag right after this line-

$newsdisplay = '3'; //This is how many news articles are displayed.

3 (edited by Mark 2006-07-16 07:31)

Re: Index Problem

one thing is, you are opening another php section when there is one open.

<?php
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';


// Load all the language files
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';
require PUN_ROOT.'include/parser.php'; 

$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';

$newsid = '1'; //This is the forum the news is retrieved from
$newsdisplay = '3'; //This is how many news articles are displayed.

<div id="portalconsole" class="block2col">
    <div class="blockmenu" style="float:left;width:180px">
    <br />
    <h2><span>Navigation</span></h2>
    <div class="box">
        <div class="inbox">
        <ul>
<?
        $links = array();

oo i was a bit late tongue

4

Re: Index Problem

you you really need 

?>

at the end of the footer?

5

Re: Index Problem

no you dont need it i just put it there for no reason tongue ... literally.