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

Re: [Clip] Inserting an ID into a link

Expand Messages
  • Axel Berger
    ... Yes, I had understood that. But unless that string is brought by the Easter Bunny, you have to type it somewhere, so why not here? If you get it from
    Message 1 of 13 , Jun 10, 2008
      Mike Breiding wrote:
      > I was hoping for a clip which would simply insert the ID based
      > on what the linked text string would be.

      Yes, I had understood that. But unless that string is brought by the
      Easter Bunny, you have to type it somewhere, so why not here? If you
      get it from somewhere else I will need more context to see where
      it's from and how to read it out.

      > This is how the image clip I use works.

      Yes, but where does ^%imagename% come from?

      > Maybe I am thinking apples and oranges when associating these
      > two clips with each other.

      Not at all. you might need to cast your net a bit wider and think a
      little more out of the box, but in principle a link is a link.

      > I disagree. ;-)

      Up to you of course. I've stated my case and rest it there. For our
      party page I was asked to open new windows too, and I refused. (The
      additional rerason here was, that with "show pdf in browser window"
      off, as every sensible user has it, they would all have been empty
      windows.)

      Axel
    • 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 2 of 13 , Jun 10, 2008
        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.