Recent Topics

1 Nov 17, 2005 22:09    

Seeing that there isnt a your updates/upgrades section for b2evolution i might as well post this here.

I am about to do some heavy modding of b2evolution and for that i need to mod the tabs, and the code was rather messy.

Here is my update to the tab display code in the _menutop.php file:


		$admin_tabs = array(
				array("new",	'<a href="b2edit.php?blog='.$blog.'" style="font-weight: bold;">Write</a>'),
				array("edit",	'<a href="b2browse.php?blog='.$blog.'" style="font-weight: bold;">Edit</a>'),
				array("cats",	'<a href="b2categories.php?blog='.$blog.'" >Categories</a>'),
				array("blogs",	'<a href="b2blogs.php" >Blogs</a>'));
		
		if( $current_User->check_perm( 'stats', 'view' ) )
			$admin_tabs[] = array("stats", '<a href="b2stats.php" >Stats</a>');
		
		if( $current_User->check_perm( 'spamblacklist', 'view' ) )
			$admin_tabs[] = array("antispam", '<a href="b2antispam.php" >Antispam</a>');
			
		if( $current_User->check_perm( 'templates', 'any' ) )
			$admin_tabs[] = array("templates", '<a href="b2template.php" >Templates</a>');
			
		if( $current_User->check_perm( 'users', 'view' ) )
			$admin_tabs[] = array("users", '<a href="b2users.php" >Users</a>');
		else
			$admin_tabs[] = array("users", '<a href="b2users.php" >User Profile</a>');
			
		if( $current_User->check_perm( 'options', 'view' ) )
			$admin_tabs[] = array("options", '<a href="b2options.php" >Settings</a>');

		$admin_tabs[] = array("tools", '<a href="tools.php" >Tools</a>');
		
		foreach($admin_tabs as $tab){
			if($tab[0] == $admin_tab)
				echo '<li class="current">';
			else
				echo '<li>';
			echo $tab[1];
			echo '</li>';
		}		
		
		unset($admin_tabs);

So instead of doing alot of ifs and echos, we have our info in an array.
Which is much cleaner for adding/customizing the tabs.

2 Nov 18, 2005 04:39

So if I understand what you did here, you have changed the existing messy code to a cleaner code...but the function of the tabs is still the same.

Looks good to me! :lol:


Form is loading...

CMS software – This forum is powered by b2evolution CMS, a complete engine for your website.