Additional Nav Bar

From PunBB Resource Wiki

Jump to: navigation, search

Want to add another nav bar to your forum? Follow this to do so.

// START SUBST - <pun_navlinks2>
$tpl_main = str_replace('<pun_navlinks2>','<div id="brdmenu" class="inbox">'."\n\t\t\t". generate_navlinks2()."\n\t\t".'</div>', $tpl_main);
// END SUBST - <pun_navlinks2>
<pun_navlinks2>
	// Are there any additional navlinks we should insert into the array before imploding it?
	if ($pun_config['o_additional_navlinks'] != '')
	{
		if (preg_match_all('#([0-9]+)\s*=\s*(.*?)\n#s', $pun_config['o_additional_navlinks']."\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="navextra'.($i + 1).'">'.$extra_links[2][$i]));
		}
	}
//
// New navbar
//
function generate_navlinks2()
{
	global $pun_config, $lang_common, $pun_user;
 
	// Index and Userlist should always be displayed
	$links[] = '';
 
	// Are there any additional navlinks we should insert into the array before imploding it?
	if ($pun_config['o_additional_navlinks'] != '')
	{
		if (preg_match_all('#([0-9]+)\s*=\s*(.*?)\n#s', $pun_config['o_additional_navlinks']."\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="navextra'.($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>';
}

--Mark 23:17, 25 January 2008 (GMT)

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox