1

Topic: Help Please!

Ok heres my problem.....right now iam trying to create a second navigation link called <pun_memblinks>

sort of similar to <pun_navlinks> expect in this navigation bar it only contains basic member navigation such as links to there profiles, messages, there posts, login, logout ect. well you get the point. Heres the code that iam placing at the end of functions.php and im getting the following error

My Error:

Parse error: syntax error, unexpected $end in /home/fatalgam/public_html/fatal-gfx/include/functions.php on line 1117

My Code:

//
// Generate the "navigator" that appears at the top of every page
//
function generate_memblinks()
{
    global $pun_config, $lang_common, $pun_user;

    
// Index and Userlist should always be displayed
    


    

    if ($pun_user['is_guest'])
    {
        

        $info = $lang_common['Not logged in'];
    }
    else
    {
        if ($pun_user['g_id'] > PUN_MOD)
        {
            $links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>';
            $links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
        }
        else
        {
            
            $links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>';
            $links[] = '<li id="navadmin"><a href="admin_index.php">'.$lang_common['Admin'].'</a>';
            $links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
        }

As you can see this code is almost a duplicate of the navlinks generation code....with just some parts edited out.

Re: Help Please!

You're missing a } at the end

3 (edited by StevenBullen 2006-09-29 23:46)

Re: Help Please!

Remember to change header.php as well.

Re: Help Please!

Grr... smartys beat me.

5 (edited by Tubby 2006-09-30 00:52)

Re: Help Please!

nope thats not the answer to my problem iam still getting the same error when i add the code to the end...and yes i did edit header.php and i did place the <pun_memblinks> in the proper tpl files.

Here is my code that i have added to header.php

// START SUBST - <pun_memblinks>
$tpl_main = str_replace('<pun_memblinks>','<div id="brdmenu" class="inbox">'."\n\t\t\t". generate_memblinks()."\n\t\t".'</div>', $tpl_main);
// END SUBST - <pun_memblinks>

Heres my edited code from functions.php

//
// Generate the "navigator" that appears at the top of every page
//
function generate_memblinks()
{
    global $pun_config, $lang_common, $pun_user;

    
// Index and Userlist should always be displayed
    


    

    if ($pun_user['is_guest'])
    {
        

        $info = $lang_common['Not logged in'];
    }
    else
    {
        if ($pun_user['g_id'] > PUN_MOD)
        {
            $links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>';
            $links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
        }
        else
        {
            
            $links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>';
            $links[] = '<li id="navadmin"><a href="admin_index.php">'.$lang_common['Admin'].'</a>';
            $links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
        }
}

heres the same error only on a different line

Parse error: syntax error, unexpected $end in /home/fatalgam/public_html/fatal-gfx/include/functions.php on line 1119

Re: Help Please!

You're missing another }, sorry wink

7

Re: Help Please!

ok thank you very much smartys smile but i seem to have another problem.....ive done everything correctly and i now have it in my main.tpl and the navbar shows up but the links from functions.php dont show up in the bar even though they are in functions.php....take a look at the code and then visit the page to get a good look at this error.

visit www.fatal-gfx.com/index.php and observe this code and tell me what  my problem could be.

function generate_memblinks()
{
    global $pun_config, $lang_common, $pun_user;

if ($pun_user['is_guest'])
    {
       $links[] = '<li id="navregister"><a href="register.php">'.$lang_common['Register'].'</a>';

$links[] = '<li id="navlogin"><a href="login.php?action=in&id='.$pun_user['id'].'">'.$lang_common['Login'].'</a>';

        $info = $lang_common['Not logged in'];
    }
    else
    {
        if ($pun_user['g_id'] > PUN_MOD)
        {
            $links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>';
            $links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
        }
        else
        {
            
            $links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>';
            $links[] = '<li id="navadmin"><a href="admin_index.php">'.$lang_common['Admin'].'</a>';
            $links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
        }
}
}

8 (edited by StevenBullen 2006-09-30 03:51)

Re: Help Please!

Check out the normal menu function 'function generate_navlinks()'...  at the end you have this bit of code...

    return '<ul>'."\n\t\t\t\t".implode($lang_common['Link separator'].'</li>'."\n\t\t\t\t", $links).'</li>'."\n\t\t\t".'</ul>';

This returns the links and code... so you need to modify yours to match. big_smile
Bascially put that before your very last }


Beat you this time Smartys

9 (edited by Tubby 2006-09-30 04:18)

Re: Help Please!

yes i thought it had something to do with that last line of code tongue thank you for confirming that for me steven.

It now works like a charm!! Thank you for all of your support!! This is why i love punbb

Come check it out by visiting www.fatal-gfx.com/index.php