The function.
The function generates a collection of unordered lists from a link in a menu item. It opens the links in a new window. Since the index is generated at runtime from the menu data, it should always accurately reflect your current menu navigation. The links in the index window control navigation in the parent window.Things of Note
- images if you use images rather than text that item is shown as 'undefined'. The first item of the sample is an image only item. Item two is the same item but with text. Generate the site index to note the results for them.
- clickfunction If a item contains javascript (a clickfunction setting) then the javascript is ignored when the index link is created.
- url=javascript: If the link has a url setting that contains javascript (e.g., url=javascript:someFunction()) then the link is not created.
- as a side note Though the module is designed to generate a
siteindex from, and for use with, the Milonic Menu system, there are other things you might do with
the generated page.
- It could be saved and used to check links with a link checker program. Because this is generted at runtime, this could be useful to make sure no links are broken, particularly offsite links.
- The generated page might also be used as a sitemap, making it easy to keep your sitemap current. You might need to modify the page for such use so view the source and make any changes you deem necessary before uploading it as your sitemap. You may wish to set window attributes and have it open links in its parent window, for example.
The parameters.
mm_siteIndex() is the function name. It takes three [3] parameters.- windowAttributes is a string containing a comma-separated list of optional window attributes or features you can apply to the popup site index window. These attributes are inherent to the native javascript window.open() method, and may vary across browsers. See here for a description of possible attributes
- indexHeading is a string to use as the textual heading that will appear at the top of the site index window. The heading uses the <h1> tag, and can therefore be styled by applying css rules to <h1> in a style sheet.
- cssFile (this attribute is optional) It is a string containing the path and filename of a .css file that you want to apply to the site index window. If cssFile is not specified, the browser's default styling will apply. The site index window uses the following tags that you may want to style: <body>, <h1>, <ul>, <li>, ..
Instructions
- Download the mm_siteIndex.js file.
- Edit your menu_data.js file and create the aI string where you want the link to generate the site index.
aI("text=YourText;url=javascript:mm_siteIndex('windowAttributes', 'Heading to appear on the page','cssFile [this is optional');");
- Place the call for the file wherever you want, you could even put it in an include file
<SCRIPT language=Javascript src="mm_siteIndex.js" type=text/javascript></SCRIPT>
Modifying The Parameters
- The aI string which
generates the page in this sample is:
aI("text=Site index;url=javascript:mm_siteIndex('top=0,left=0,height=500,width=400', 'Milonic Site Index','siteindex.css');");
- You can modify the parameters for the windowAttributes, indexHeading and the optional cssFile
aI("text=itemText;url=javascript:mm_siteIndex('windowAttributes', 'indexHeading','cssFile [this is optional');");
where itemText is the text that you want to appear in the menu item, 'windowAttributes' are the placement, dimensions, attributes such as toolbar that you want for the window that will open, indexHeading is the Heading [text] that will appear at the top of the window, and cssFile is the file you have created for the css style of the page being opened. This is an optional attribute and does not need to be included if you don't want to apply css styles to the page. If you do not include css the aI string would be as follows
aI("text=itemText;url=javascript:mm_siteIndex('windowAttributes','indexHeading');");
Find out more about window attributes and what can be use here.