Topic: Question regarding the navlinks

I am having some problems with this area and I don't know how to resolve it. I am using the frontpage mod with the sidelinks which is called from the main.tpl file. The problem that I am having is that id's are assigned to them so when the w3c validation sees it, it reports that the ID has already been used. This is obviously because of the fact that the punbb navlinks are in the header area already. How can I work around this to avoid the warnings.

btw: I do need to leave the id's in the functions file which is assigned to the pun links, only because my classes are already setup to use them

Thanks for any help here.
Bingiman

2 (edited by liquidat0r 2007-10-10 21:55)

Re: Question regarding the navlinks

The only solution I can come up with is to make a new function in functions.php and change all the IDs:

function generate_sidelinks()

Based on function generate_navlinks(), you can then change the "get the side links" thing in header.php.

----
So where generate_navlinks looks something like this:

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

    // Index and Userlist should always be displayed
    $links[] = '<li id="navindex"><a href="index.php">'.$lang_common['Index'].'</a>';

...

generate_sidelinks would look like this:

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

    // Index and Userlist should always be displayed
    $links[] = '<li id="sideindex"><a href="index.php">'.$lang_common['Index'].'</a>';

...

Re: Question regarding the navlinks

Sweet!

This is what I did based on your instructions:

functions.php now include:

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

    // Index and Userlist should always be displayed
    $links[] = '<li id="sideindex"><a href="index.php">'.$lang_common['Index'].'</a>';
    $links[] = '<li id="sideuserlist"><a href="userlist.php">'.$lang_common['User list'].'</a>';


    if ($pun_config['o_rules'] == '1')
        $links[] = '<li id="siderules"><a href="misc.php?action=rules">'.$lang_common['Rules'].'</a>';

    if ($pun_user['is_guest'])
    {
        if ($pun_user['g_search'] == '1')
            $links[] = '<li id="sidesearch"><a href="search.php">'.$lang_common['Search'].'</a>';

        $links[] = '<li id="sideregister"><a href="register.php">'.$lang_common['Register'].'</a>';
        $links[] = '<li id="sidelogin"><a href="login.php">'.$lang_common['Login'].'</a>';

        $info = $lang_common['Not logged in'];
    }
    else
    {
        if ($pun_user['g_id'] > PUN_MOD)
        {
            if ($pun_user['g_search'] == '1')
                $links[] = '<li id="sidesearch"><a href="search.php">'.$lang_common['Search'].'</a>';

            $links[] = '<li id="sideprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>';
            //require(PUN_ROOT.'include/pms/functions_navlinks.php');
            if($pun_config['o_pms_enabled'] && $pun_user['g_pm'] == 1)
            $links[] = '<li id="sidemessage_list"><a href="message_list.php">'.$lang_common['Messages'].'</a>';

            $links[] = '<li id="sidelogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
        }
        else
        {    
            $links[] = '<li id="sideuploadimg"><a href="uploadimg.php">'.$lang_common['Upload Image'].'</a>';
            $links[] = '<li id="sidesearch"><a href="search.php">'.$lang_common['Search'].'</a>';
            $links[] = '<li id="sideprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>';
            $links[] = '<li id="sideadmin"><a href="admin_index.php">'.$lang_common['Admin'].'</a>';
            if($pun_config['o_pms_enabled'] && $pun_user['g_pm'] == 1)
            $links[] = '<li id="sidemessage_list"><a href="message_list.php">'.$lang_common['Messages'].'</a>';
            $links[] = '<li id="sidelogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>';
        }
    }

    // Are there any additional sidelinks we should insert into the array before imploding it?
    if ($pun_config['o_additional_sidelinks'] != '')
    {
        if (preg_match_all('#([0-9]+)\s*=\s*(.*?)\n#s', $pun_config['o_additional_sidelinks']."\n", $extra_links))
        {
            // Insert any additional links into the $links array (at the correct index)
            for ($i = 0; $i < count($extra_links[1]); ++$i)
                array_splice($links, $extra_links[1][$i], 0, array('<li id="sideextra'.($i + 1).'">'.$extra_links[2][$i]));
        }
    }

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

header.php now includes:

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

and main.tpl now includes:

    <div class="block">
        <h2><span>Menu</span></h2>
        <div class="box">
        <pun_sidelinks>            
        </div>
    </div>

It works GREAT! Thank you so much for your help on this.

Bingiman