Loading ...
Sorry, an error occurred while loading the content.

Re: [Clip] Inserting an ID into a link

Expand Messages
  • Axel Berger
    ... Easily. I was rather surprised about your ^?{(T=T;F= Files|* )Link to Internal File=}; to be honest. What I use myself is this (with a slightly different
    Message 1 of 13 , Jun 10, 2008
    • 0 Attachment
      Mike Breiding wrote:
      > Can this be made to with external links?

      Easily. I was rather surprised about your
      ^?{(T=T;F="Files|*")Link to Internal File=};
      to be honest. What I use myself is this (with a slightly different
      filename):

      ^!Set %varURL%=^?{(T=O;
      F="Link Files|*.*htm*;*.php;*.pdf;*.pl;*.cgi")
      Enter a URL (add "a")};
      %varDSC%=^?{Enter a description for this link}
      ^!IfTrue ^$IsUrl("^%varURL%a.htm")$ SKIP
      ^!Set %varURL%=^$FileToUrl("^$GetRelativeName(^%varURL%)$")$
      ^!Set %varURL%=^$StrReplace("../";"/";"^%varURL%";False;False)$
      ^!Set %varURL%=^$StrReplace("&";"&";"^%varURL%";False;False)$
      ^!Set %varURL%=^$StrReplace
      ("&";"&";"^%varURL%";False;False)$
      ^!If "^$StrCopyRight("^%varURL%";2)$" <> "/a" SKIP
      ^!Set %varURL%=^$StrDeleteRight("^%varURL%";1)$
      ^!InsertHtml <A HREF="^%varURL%">^%varDSC%</A>^&

      You will want to change the extensions you're looking for a bit.
      Having chosen the file I do the following:

      1) If it is a valid URL -- perhaps ending in "/", so adding "a.htm"
      will make it a fully resolved one, if not NotTab sees
      "page.htm.a.htm" as a valid name -- skip the next line.
      2) (If not skipped) take the chosen file, make its absolute path a
      relative one, and make a URL out of the path.
      3) The file I'm working on is typically one folder down from the
      root on my sites, i.e. all .htm are in folders but only one level
      deep. If so the relative destination "../" is equivalent to root "/"
      and should be written as such.
      4) URLs copied from the browsers often contain data. The separator
      "&" should be written as an entity "&"
      5) But only once.

      Now it gets slightly more complicated. Often URLs end in a "/" like
      my own homepage "www.berger-odenthal.de/" NoteTab does not like
      these URLs. So up top I remind myself:
      <Enter a URL (add "a")>. So after pasting the above example I do
      just that and make it "www.berger-odenthal.de/a". (Iirc it's the
      FileToUrl that requires this). So now it's time to rid ourselves of
      that superfluous "a" again.

      6) Check if it's there in the first place, if not skip the following
      line.
      7) If not skipped delete the last letter of the URL.

      Done.

      Axel

      P.S: It is Axel, not Alex, please.
    Your message has been successfully submitted and would be delivered to recipients shortly.