Drop Shadow

XML Navigation Links

You have two options for making your left navigation menu. One is to make the links by hand and ensure that they are the same in every page. The other is to place a file called “subnav.xml” in your directory. All pages in that directory and below will automatically use the subnav.xml file to create their left navigation menu.

Sample subnav.xml file

Here is an example of a subnav.xml file with only one entry, a link to “/news/pr.php” as “Press Releases”:

<?xml version="1.0"?> <!DOCTYPE navigation [ <!ENTITY basePath "/news/"> ]> <navigation section="news"> <navitem id="pr" label="Press Releases" link="&basePath;pr.php" /> </navigation>

This file has two parts: the “DOCTYPE” area and the “navigation” area.

In the DOCTYPE area, you set the default style for your menu. You will almost always want to leave that as “tertnav”. This is the official USD style for navigation items.

Navigation items

The ‘basePath’ is the part of the path that always appears in front of your links. If all of your links begin with http://www.sandiego.edu/ITS/DSS/, for example, your basePath will be “/ITS/DSS/”. Using the ‘basePath’ allows you to easily change your subnav.xml file links if your site moves for whatever reason.

The “navigation” area contains each of your links. Each link consists of four or five attributes: an “id”, which must be unique, a “label” which will be the name of your link, and a “link”, which will be the actual path to the link.

The subnav system can detect which page the reader is on, and gray out that link. But to do this, the “id” must be the same as the filename but without the extension. In the case of index pages, which you do not link to as “index.php”, you do want the “id” to be “index”:

<navitem id="index" label="Home" link="&basePath;" />

You can add as many “navitem” items as you wish. Just keep the “id” unique for each item. For example, here is a subnav.xml file with two items, one that will appear as “Software” and one that will appear as “Feedback”:

<?xml version="1.0"?> <!DOCTYPE navigation [ <!ENTITY basePath "/ITS/dss/"> ]> <navigation section="dss"> <navitem id="pr" label="Software" link="&basePath;software/" /> <navitem id="pr" label="Feedback" link="&basePath;feedback.php" /> </navigation>

Optional attributes

You can also add an “indent” attribute, which is a number (“1”) denoting sublists. Sublists are usually “indented” to the right. The larger the number, the further the indent.

If this is an external link to outside USD, you can add the “type” attribute, and set it to “external”. Currently, links marked as “external” will open in a separate window.

If you want a special class applied to an item, you can add the “class” attribute, and set it to whatever CSS class name you want. Currently, if you do not specify a class items will be marked with the “tertnav” series of class names.

Here’s an example of a subnav item with the optional attributes:

<navitem id="pr" label="Software" link="http://www.macupdate.com/" class="newslink" type="external" indent="1" />