4 Replies Latest reply on Nov 20, 2007 11:25 AM by (symvar)

    Transform toolbox output into valid code

      Hi Folks,

      I'm having some trouble with adjusting the toolbox output into valid code, for example ill take the toolbox output for a Logout form link:

      href="getLogoutLink(); ?>"

      After loading the page in a browser we get this:

      href="http://www.website.com/index.php?page=redirect_user&KT_logout_now=1"

      The & doesn't validate as it should be & a m p ; (escaped or else it gets transformed into &)

      Could someone give me a hint on how to adjust this so it outputs valid links?

      Thanks in advance for any comments :)
      symvar
        • 1. Re: Transform toolbox output into valid code
          Günter Schenk Level 4
          Hi Symvar,

          ------
          The '&' doesn't validate is it should be '&'
          ------

          I don´t see any difference, lol :-)

          However, the '&' is common standard in PHP, because it´s this char which is meant to concatenate multiple URL variables (redirect_user&KT_logout_now=1). It´s maybe not a "valid" link as such, but for PHP it´s a required char, which is perfectly understood by browsers.

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Transform toolbox output into valid code
            Level 1
            Hi Günter,

            I understand that & is needed in php ;p

            In this case a link with & a m p ; (spaces between characters so it wont transform into &) will work just as good as a link with & in it with the difference that the first validates and the second doesnt.

            I think its just a matter of format the link in the right way before it is outputted, but i dont see where to do this :)

            Regards,
            Symvar
            • 3. Re: Transform toolbox output into valid code
              Günter Schenk Level 4
              Hi Symvar,

              --------
              In this case a link with & a m p ; (spaces between characters so it wont transform into &) will work just as good as a link with & in it with the difference that the first validates and the second doesnt.
              --------

              to my knowledge enclosing that link in PHP´s "htmlspecialchars" function would do just that:

              getLogoutLink()); ?>

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: Transform toolbox output into valid code
                Level 1
                Your right, thats amazing :)

                this is the code now:

                href="getLogoutLink(), ENT_NOQUOTES); ?>"

                and it works great.
                Thx for the suggestion ^^

                Regards,
                Symvar