logo

New Response

« Return to the main article

You are replying to:

  1. What about backing out FROM a document? ../ isn't always fool proof when there are nested views. By nested views, I mean when you create views with names containing a "category" followed by a \

    All Documents\By Subject All Documents\By Date

    This could create URL leveling issues with relative URLS that back out from documents in the view using ../ to get to an image resource or something.

    http://host/database.nsf/ViewNoteID/DocumentUnid?OpenDocument This is only two levels from database.nsf

    http://host/database.nsf/All+Documents/By+Subject/DocumentUnid?OpenDocument This is three levels from database.nsf

    The above two examples are two possible URLs for the same document, each a different number of levels from database.nsf

    Of course, you could code out the possibility of hitting URLs with one of those structures above for consistency, but this kind of goes against my nature.

    My workaround is to use relative URLs starting with a /

    <a href="/database.nsf/Pic.gif?OpenImageResource">click me</a>

    I think / gives you a different kind of relativity, relativity to the HOST. I think I'm right it seems to work.

    So you have to get hold of the database file path, which I do using @ReplaceSubString( @Subset( @DBName; -1 ); "\\"; "/" ).

    SO I end up using something like this

    <a href="/<ComputedText>/nude.gif?OpenImageResource">click me</a>

    <ComputedText> has the formula: @ReplaceSubString( @Subset( @DBName; -1 ); "\\"; "/" ). It would compute to A55692/store.nsf here I think, so when rendered for the browser by Domino it would say

    <a href="/A55692/store.nsf/nude.gif?OpenImageResource">click me</a>

    I'm faily sure that if you clicked this link, regardless of whether you were clicking from two or three levels in from store.nsf, it would still work.

    If I'm wrong, I'd appreciate being told so. It works on my app, but, you know.

    Also I'd love to know if I'm making this more complicated than it needs to be. Maybe there's some other way of using relative links reagrdless of whether the current document's nested view is shown in the address bar as /blah/blah/ or /NoteID/

    Interesting

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: