• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Nicaw - online/offline Menu

rena.to

TibiaKing Co-founder
Joined
Jul 20, 2010
Messages
57
Reaction score
9
Location
Brasil
In nicaw aac, the menu is built by xml and not by php.
Then, in this topic I'll teach you to show different menu to online and offline accounts in site.

First step - XML
Open file navigation.xml in root of your site.
Create menu to offline and menu to online, and add the tag status => 'online' to menu that display in online acc and 'offline' to menu that display offline (obvious?).
My example:

Code:
<category name="Account" status="offline">
	<item href="login.php?redirect=account.php">Login</item>
	<item href="register.php">Create Account</item>
</category>
<category name="Account" status="online">
	<item href="account.php">Account Managment</item>
</category>

Second step - PHP
If you finish here, in your site will appear the two menus, and you dont want this.
Then open the file header.inc.php in root of your site.

Replace this code:
Code:
if (file_exists('navigation.xml')){
	$XML = simplexml_load_file('navigation.xml');
	if ($XML === false) throw new aacException('Malformed XML');
}else{die('Unable to load navigation.xml');}
foreach ($XML->category as $cat){
	echo '<div class="top" onclick="menu_toggle(this)" style="cursor: pointer;">'.$cat['name'].'</div><ul>'."\n";
	foreach ($cat->item as $item)
		echo '<li><a href="'.$item['href'].'">'.$item.'</a></li>'."\n";
	echo '</ul><div class="bot"></div>'."\n";
}

To:

Code:
if(!$_SESSION['account'] || $_SESSION['account'] == '' && empty($_COOKIE['remember']){ $online = 'off';  } else { $online = 'on'; }
 
if (file_exists('navigation.xml')){
	$XML = simplexml_load_file('navigation.xml');
	if ($XML === false) throw new aacException('Malformed XML');
}else{die('Unable to load navigation.xml');}
foreach ($XML->category as $cat){
	if($online=='on'){ if($cat['status'] == 'offline'){ continue; }}
	if($online=='off'){ if($cat['status'] == 'online'){ continue; }}
	echo '<div class="top" onclick="menu_toggle(this)" style="cursor: pointer;">'.$cat['name'].'</div><ul>'."\n";
	foreach ($cat->item as $item)
		echo '<li><a href="'.$item['href'].'">'.$item.'</a></li>'."\n";
	echo '</ul><div class="bot"></div>'."\n";
}

Now, you may test.

Ah, sorry for my bad english :)
 
Back
Top