Fuzed Fuzed

Modification: Shedrock's Navigation Panel

Version: 1.20

Copyright © Fuzed Themes

Introduction

This improved version of Shedrock's Navigation Panel allows you to control the categories and links from the admin area.

New features in this version:

  • use images and text together in link names
  • collapse a category - links are hidden until the category is clicked

Note: This panel completely replaces the core navigation panel.

This package contains the following files:

administration
infusions.php
site_links.php
images
infusions
navigation_panel
images
navigation_panel.php
locale
English
admin
sitelinks.php
restricted.php
restricted.php

Installation

* * * Backup your website before uploading or modifying any files * * *


Note: You need to follow both steps of the installation, even if you've installed an earlier version of this mod.

There are 2 steps to the installation and if you follow them closely, you shouldn't have any problems.

Step 1: Upload the contents of the php-files folder to the appropriate directories on your site.

Step 2: Go to Admin --> Custom Pages and paste the following code into the page content field, then preview the page... don't save it, preview only...

<?php
$changes = 0; $error = 0;
$result = dbquery("SHOW COLUMNS FROM ".$db_prefix."site_links LIKE 'link_parent'");
if (dbrows($result) == 0) {
	$result = dbquery("ALTER TABLE ".$db_prefix."site_links ADD link_parent SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER link_id");
	if ($result) {
		$result = dbquery("INSERT INTO ".$db_prefix."site_links
			(link_parent, link_name, link_url, link_visibility, link_position, link_window, link_order)
			VALUES ('0', 'Home', 'icon_home.gif', '0', '1', '0', '1')"
		);
		$parent = mysql_insert_id();
		$result = dbquery("UPDATE ".$db_prefix."site_links SET link_parent='$parent' WHERE link_id!='$parent'");
		$changes = 1;
	} else {
		echo "<p align='center'><font color='red'><b>ERROR:</b></font> The link_parent column was not added.</p>";
		$error ++;
	}
} else { $changes = 1; }
if ($changes != 0) {
	$result = dbquery("SHOW COLUMNS FROM ".$db_prefix."site_links LIKE 'link_accessibility'");
	if (dbrows($result) == 0) {
		$result = dbquery("ALTER TABLE ".$db_prefix."site_links ADD link_accessibility TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER link_visibility");
		if ($result) {
			$result = dbquery("UPDATE ".$db_prefix."site_links SET link_accessibility=link_visibility");
		} else {
			echo "<p align='center'><font color='red'><b>ERROR:</b></font> The link_accessibility column was not added.</p>";
			$error ++;
		}
	}
}
$result = dbquery("SHOW COLUMNS FROM ".$db_prefix."site_links LIKE 'link_collapse'");
if (dbrows($result) == 0) {
	$result = dbquery("ALTER TABLE ".$db_prefix."site_links ADD link_collapse TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER link_accessibility");
	if (!$result) {
		echo "<p align='center'><font color='red'><b>ERROR:</b></font> The link_collapse column was not added.</p>";
		$error ++;
	}
}
if ($error == 0) { echo "<p align='center'>Table alterations are complete.</p>"; }
?>
FAQ

Q: I'm getting this error --> Unknown column 'link_parent' in 'where clause' <-- how do I fix it?

A: You need to follow both steps in the installation instructions.


Q: I'm getting this error --> Notice: Undefined index: link_accessibility ... <-- how do I fix it?

A: You need to follow both steps in the installation instructions.


Q: I'm getting this error --> Unknown column 't1.link_collapse' in 'field list' <-- how do I fix it?

A: You need to follow both steps in the installation instructions.


Q: I'm not getting any errors, but I can't create or edit the links... what's wrong?

A: You need to follow both steps in the installation instructions.


Q: All of my links have disappeared and I'm getting a message saying that no links are defined... what's wrong?

A: You need to follow both steps in the installation instructions.


Q: In site links admin, when I click the up/down arrows, the links/categories don't change position, what's wrong?

A: Try clicking the 'Refresh Link Ordering' link - it's at the bottom of the site links list.


Q: How do I collapse a category so the links are hidden until the category is selected from the navigation panel?

A: When adding or editing a category, check the 'Collapse Category' box.


Q: How do I make a restricted link - one that everyone can see, but only members can access?

A: While adding or editing the link, set the visibility to Public and the accessibility to Member.


Q: What's difference between link visibility and accessibilty?

A: Visibility controls who can see the links and accessibility contols who can access the url. Let's say that you set a link's visibility to 'Public' and the accessibility to 'Member', this will allow guests to see the link, but only members will be able to access the real url. Guests who click the link will be taken to a page (restricted.php) that'll display a message telling them that the area is restricted.


Q: Do I have to set both the visibility and accessibility for a link if they're going to be the same?

A: No, if you don't set the visibility, the accessibility setting will automatically be used.


Q: When I use bbcode or images, the links in the sub-header don't display properly. How can I make it work?

A: If you're using a theme that uses the showsublinks function, then you can make it work by following the instructions below. If your theme doesn't use the showsublinks function, then using the instructions below won't have any effect... ask for help in the Fuzed Themes forum.

Open includes/theme_functions_include.php and find...

					if (strstr($sdata['link_url'], "http://") || strstr($sdata['link_url'], "https://")) {
						$res .= "<a href='".$sdata['link_url']."'".$link_target.$link_class.">".$sdata['link_name']."</a>";
					} else {
						$res .= "<a href='".BASEDIR.$sdata['link_url']."'".$link_target.$link_class.">".$sdata['link_name']."</a>";
					}

REPLACE with...

					$link = explode(" ", $sdata['link_name']);
					for($i = 0; $i < count($link); $i ++) {
						$ext = strrchr($link[$i], ".");
						if ($ext == ".gif" || $ext == ".jpg" || $ext == ".png") {
							$link[$i] = "<img src='".BASEDIR.$link[$i]."' alt=''>";
						}
					}
					$sdata['link_name'] = implode(" ", $link);
					$sdata['link_name'] = preg_replace('#\[b\](.*?)\[/b\]#si', '<b>\1</b>', $sdata['link_name']);
					$sdata['link_name'] = preg_replace('#\[i\](.*?)\[/i\]#si', '<i>\1</i>', $sdata['link_name']);
					$sdata['link_name'] = preg_replace('#\[u\](.*?)\[/u\]#si', '<u>\1</u>', $sdata['link_name']);
					$sdata['link_name'] = preg_replace('#\[color=(black|blue|brown|cyan|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|violet|white|yellow)\](.*?)\[/color\]#si', '<span style=\'color:\1\'>\2</span>', $sdata['link_name']);
					if (checkgroup($sdata['link_accessibility'])) {
						if (strstr($sdata['link_url'], "http://") || strstr($sdata['link_url'], "https://")) {
							$res .= "<a href='".$sdata['link_url']."'".$link_target.$link_class.">".$sdata['link_name']."</a>";
						} else {
							$res .= "<a href='".BASEDIR.$sdata['link_url']."'".$link_target.$link_class.">".$sdata['link_name']."</a>";
						}
					} else {
						echo "<img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."restricted.php'".$link_target.">".$sdata['link_name']."</a> <img src='".INFUSIONS."navigation_panel/images/icon_stop.gif' alt=''><br>\n";
					}

Q: How can I make a link bold/itialic/colored/underlined?

A: When adding or editing a link, use bbcode in the site link's name... see the example below.


Q: How can I make a link that displays an image instead of text?

A: Upload the image to your site, then go to site links admin and fill in the 'Add Site Link' form. In the link name textbox, add the url to the image, instead of a link name... see the example below.


Q: How can I make a link that displays an image as well as text?

A: Follow the same steps as described above for adding an image, but add the text as well. Just be sure that the image path and text are separated by a space. Example: Research images/important.gif

Looking for Support?

Please visit us as Fuzed Themes and post your questions regarding this mod in the forum.