King Solomon Web Specs Download Purchase=$100 Support Contact
by Anasoftware
Implementing Return Links
A return link is a link/span on a topic page (usually part of the header) that returns a page to the KB. Thus, if the page is displayed at top level, taking the entire browser window, clicking a return link displays the KB frameset, where the original page takes the main frame. To implement return links, follow these steps:

1. You may enclose the return links in a DIV or SPAN element as follows:

<div id="returnlinks"> ... </div>

where the returnlinks ID is required and should not be changed. Place DIV at the very beginning of the topics' header.

2. Simplified, a return link may look like one of these:

<span onclick="frm('toc');">Hierarchy</span>
<span onclick="frm('index');">Index</span>

You may add formatting (mouseover, pointer, etc.) or use an A element instead.

3. Here is the frm() function:
 

function frm(pane)
{
    var l = location, slash, base, par, bkm, idx, str, fn;
    slash = l.href.lastIndexOf('/');
    base = l.href.substring(0, slash);
    par = l.href.lastIndexOf('?');
    bkm = l.href.lastIndexOf('#');
    if (par == -1 && bkm == -1)
        idx = -1;
    else if (par == -1 && bkm != -1)
        dx = bkm;
    else if (par != -1 && bkm == -1)
        idx = par;
    else if (par != -1 && bkm != -1)
        idx = Math.min(par, bkm);
    if (idx == -1)
        fn = l.href.slice(slash + 1);
    else
        fn = l.href.substring(slash + 1, idx);
    if (l == top.location)
    {
        str = '/ksw/frameset.htm' + l.search + l.hash;
        if (bkm == -1) str += '#';
        location.href = base + str + '+' + pane + '.htm+../' + fn;
    }
}

Use it exactly as shown. The pane argument can take 2 values, toc or index, causing the HI frame to show the hierarchy, or the index. You'll probably include this function with the rest of your JavaScript in a .js file you reference on your pages' template.

Note. You may include return links for both the hierarchy and the index. When strict 'close' control is enforced ("'close' strict mode" in KSW Options > Project Options > Web Config is checked), only pages with a returnlinks element ID respond to the 'close' link.

Note. When your KB configuration is TOC Only, or Index Only (see KSW Options > Project Options > Web Config), it is obvious you may not implement both return links.

4. More on configuring the return links;  here is a simple method of hiding the return links when a topic is shown within the KB, and showing them otherwise (when a topic is displayed by itself, taking the full browser window):

Note. We keep suggesting code solutions for those who might need them, although we are aware many will implement their own way.

<body onload="load()">

Add the onload attribute to the topic template. Add the load() function bellow to the .js file.

function load()
{
    var el = document.getElementById('returnlinks');
    if (location == top.location)
        el.style.display = "block";
    else
        el.style.display = "none";
}

You may put a returnlinks DIV in the header, at the very top. Then when a topic is shown outside the KB, the page is shifted down a notch to make space for the newly displayed DIV, containing one or more return links.

Home Specs Download Purchase Support Contact
asp