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

Re: [Clip] Inserting an ID into a link

Expand Messages
  • Axel Berger
    ... Mike, this might be what you are looking for: ^!Set %vfile%=^?{(T=T;F= Files|* )Link to Internal File=}; %vtitle%=^?{Enter the title for this link};
    Message 1 of 13 , Jun 10, 2008
      Mike Breiding wrote:
      > I want to the clip to do the work just as in the image
      > variable clip.

      Mike, this might be what you are looking for:

      ^!Set %vfile%=^?{(T=T;F="Files|*")Link to Internal File=};
      %vtitle%=^?{Enter the title for this link};
      %vtext%=^?{Enter the text for this link}
      ^!InsertWizardHtml <A HREF="^%vfile%"
      TITLE="^%vtitle%" ID="^%xtext%">^%vtext</A>^&

      These are TWO long lines, I broke them for legibilty. While the
      other syntax is a bit more elegant I usually prefer having the ^!Set
      and the ^!Insert in separate lines for legibility, especially when
      using a single variable more than once like here.

      I have omitted your TARGET= here. Cluttering up other people's
      screens unbidden is rightly considered very bad form, it is a bit
      like letting your dog defacate on their front lawn. If they want to
      open a link in a new window, they know how to do it in their own
      chosen browser. (And if they don't even know that, then I at least
      do not consider it right to always let the least qualified and the
      least informed make the rules all the others, who nearly by
      definition use things much more intensively and thus are much more
      in need of being spared extra useless effort, have to suffer under.)

      Axel

      P.S: Thank you for reminding us of your version, you're doing the
      right thing there.
    • Axel Berger
      ... Correction: ID= ^%vtext% I let my variables begin with a v to avoid any possible problems that might arise out of variable names and keywords being the
      Message 2 of 13 , Jun 10, 2008
        Axel Berger wrote:
        > TITLE="^%vtitle%" ID="^%xtext%">^%vtext</A>^&

        Correction: ID="^%vtext%"

        I let my variables begin with a "v" to avoid any possible problems
        that might arise out of variable names and keywords being the same.
        As far as I know this is totally superfluous in NoteTab, but I do it
        all the same.

        Axel
      • Mike Breiding
        ... Hi Alex, This works - but I am LAZY! I was hoping for a clip which would simply insert the ID based on what the linked text string would be. This is how
        Message 3 of 13 , Jun 10, 2008
          Axel Berger wrote:
          > Mike Breiding wrote:
          >
          >> I want to the clip to do the work just as in the image
          >> variable clip.
          >>
          > Mike, this might be what you are looking for:
          >
          > ^!Set %vfile%=^?{(T=T;F="Files|*")Link to Internal File=};
          > %vtitle%=^?{Enter the title for this link};
          > %vtext%=^?{Enter the text for this link}
          > ^!InsertWizardHtml <A HREF="^%vfile%"
          > TITLE="^%vtitle%" ID="^%xtext%">^%vtext</A>^&

          Hi Alex,
          This works - but I am LAZY!
          I was hoping for a clip which would simply insert the ID based on what
          the linked text string would be.
          This is how the image clip I use works. I think you and Don both had a
          hand in it's creation:

          ^!InsertHtml <a href="hres/^%imagename%"><img src="^%imagename%"
          width="^%ImgWidth%" height="^%ImgHeight%" title=" Click to view
          larger image " alt="^%imagename%" id="^%imagename%"/></a>^p<p
          class="comments">  </p>^p^p

          I don't know if this can work with a link clip since the ID would be a
          text string. The %imagename% variable is selecting the filename.
          Maybe I am thinking apples and oranges when associating these two clips
          with each other.
          Thanks!
          -mb
          p.s. Re: target="_blank"
          I disagree. ;-)
        • Mike Breiding
          ... Alex, Can this be made to with external links? Thanks, -Mike The more you get the more you want -dad
          Message 4 of 13 , Jun 10, 2008
            Mike Breiding wrote:
            > Axel Berger wrote:
            >
            >>
            >> his might be what you are looking for:
            >>
            >> ^!Set %vfile%=^?{(T=T;F="Files|*")Link to Internal File=};
            >> %vtitle%=^?{Enter the title for this link};
            >> %vtext%=^?{Enter the text for this link}
            >> ^!InsertWizardHtml <A HREF="^%vfile%"
            >> TITLE="^%vtitle%" ID="^%xtext%">^%vtext</A>^&
            Alex,
            Can this be made to with external links?
            Thanks,
            -Mike
            "The more you get the more you want"
            -dad
          • 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 5 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 6 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
                ("&amp;";"&";"^%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.