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

[Cheetahtemplate-discuss] Placeholder bug?

Expand Messages
  • michelts
    Hi guys, I m using cheetah with MochiKit and I have a problem in a template, I want to write the following output:
    Message 1 of 6 , Sep 1, 2006
    • 0 Attachment
      Hi guys,

      I'm using cheetah with MochiKit and I have a problem in a template, I
      want to write the following output:

      <script type="text/javascript"><!--
      var obj1 = document.getElementById('obj1');
      var obj2 = $('obj2');
      --></script>

      The second line do the same as the first, the $(...) javascript
      function is defined by MochiKit to be a link to
      document.getElementById. My problem is that cheetah is not escaping
      the dollar sign, I try the following template:

      <script type="text/javascript"><!--
      var obj1 = document.getElementById('obj1');
      var obj2 = $$('obj2');
      var obj3 = $$\('obj3'\);
      --></script>

      This renders to the following:

      <script type="text/javascript"><!--
      var obj1 = document.getElementById('obj1');
      var obj2 = $obj2;
      var obj3 = $\('obj3'\);
      --></script>

      I'm using Cheetah2.0-rc7. Is this a bug or am I doing something wrong?
      Thanks.

      --
      Michel Thadeu Sabchuk
      Curitiba - Brasil

      -------------------------------------------------------------------------
      Using Tomcat but need to do more? Need to support web services, security?
      Get stuff done quickly with pre-integrated technology to make your job easier
      Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
      http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • Shannon -jj Behrens
      ... Heh, I was thinking of this problem the other day. I have three suggestions: o Get the JavaScript out of the HTML and use a static JavaScript file ;) o
      Message 2 of 6 , Sep 1, 2006
      • 0 Attachment
        On 9/1/06, michelts <michelts@...> wrote:
        > Hi guys,
        >
        > I'm using cheetah with MochiKit and I have a problem in a template, I
        > want to write the following output:
        >
        > <script type="text/javascript"><!--
        > var obj1 = document.getElementById('obj1');
        > var obj2 = $('obj2');
        > --></script>
        >
        > The second line do the same as the first, the $(...) javascript
        > function is defined by MochiKit to be a link to
        > document.getElementById. My problem is that cheetah is not escaping
        > the dollar sign, I try the following template:
        >
        > <script type="text/javascript"><!--
        > var obj1 = document.getElementById('obj1');
        > var obj2 = $$('obj2');
        > var obj3 = $$\('obj3'\);
        > --></script>
        >
        > This renders to the following:
        >
        > <script type="text/javascript"><!--
        > var obj1 = document.getElementById('obj1');
        > var obj2 = $obj2;
        > var obj3 = $\('obj3'\);
        > --></script>
        >
        > I'm using Cheetah2.0-rc7. Is this a bug or am I doing something wrong?
        > Thanks.

        Heh, I was thinking of this problem the other day. I have three suggestions:

        o Get the JavaScript out of the HTML and use a static JavaScript file ;)

        o Create an alias for the $ function in JavaScript.

        o Use \$().

        Happy Hacking!
        -jj

        -------------------------------------------------------------------------
        Using Tomcat but need to do more? Need to support web services, security?
        Get stuff done quickly with pre-integrated technology to make your job easier
        Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
        http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
        _______________________________________________
        Cheetahtemplate-discuss mailing list
        Cheetahtemplate-discuss@...
        https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
      • michelts
        Hi Shannon, ... 1) Get the JavaScript out of the HTML and use a static JavaScript file ;) 2) Create an alias for the $ function in JavaScript. 3) Use $(). I
        Message 3 of 6 , Sep 2, 2006
        • 0 Attachment
          Hi Shannon,

          > Heh, I was thinking of this problem the other day. I have three suggestions:

          1) Get the JavaScript out of the HTML and use a static JavaScript file ;)
          2) Create an alias for the $ function in JavaScript.
          3) Use \$().

          I can use a static javascript file, or create an alias to the $
          function in javascript, but I think this is an alternative solution to
          the real problem, I think there is a bug in cheetah namemapper. See
          the following code...

          var obj2 = $$('obj2');

          ... that renders...

          var obj2 = $obj2;

          I don't know very well where is the problem, but I will see the source
          code to solve it, I think the proper behavior should be cheetah
          scaping the dollar sign and do not touching the parentesis, as above:

          var obj2 = $('obj2');

          Thanks for all help,
          Regards.

          --
          Michel Thadeu Sabchuk
          Curitiba - Brasil

          -------------------------------------------------------------------------
          Using Tomcat but need to do more? Need to support web services, security?
          Get stuff done quickly with pre-integrated technology to make your job easier
          Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
          http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
          _______________________________________________
          Cheetahtemplate-discuss mailing list
          Cheetahtemplate-discuss@...
          https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
        • Tavis Rudd
          Hi Michelts, to escape a placeholder in Cheetah you just need to add a before the $ ( $). Thus, if you use: var obj2 = $( obj2 ) it should work fine.
          Message 4 of 6 , Sep 3, 2006
          • 0 Attachment
            Hi Michelts,
            to escape a placeholder in Cheetah you just need to add a \ before the $ (\$).
            Thus, if you use:
            var obj2 = \$('obj2')
            it should work fine.
            Cheers,
            Tavis

            On Saturday 02 September 2006 12:08 pm, michelts wrote:
            > Hi Shannon,
            >
            > > Heh, I was thinking of this problem the other day. I have three
            > > suggestions:
            >
            > 1) Get the JavaScript out of the HTML and use a static JavaScript file ;)
            > 2) Create an alias for the $ function in JavaScript.
            > 3) Use \$().
            >
            > I can use a static javascript file, or create an alias to the $
            > function in javascript, but I think this is an alternative solution to
            > the real problem, I think there is a bug in cheetah namemapper. See
            > the following code...
            >
            > var obj2 = $$('obj2');
            >
            > ... that renders...
            >
            > var obj2 = $obj2;
            >
            > I don't know very well where is the problem, but I will see the source
            > code to solve it, I think the proper behavior should be cheetah
            > scaping the dollar sign and do not touching the parentesis, as above:
            >
            > var obj2 = $('obj2');
            >
            > Thanks for all help,
            > Regards.

            -------------------------------------------------------------------------
            Using Tomcat but need to do more? Need to support web services, security?
            Get stuff done quickly with pre-integrated technology to make your job easier
            Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
            http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
            _______________________________________________
            Cheetahtemplate-discuss mailing list
            Cheetahtemplate-discuss@...
            https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
          • michelts
            Hi Tavis, Excuse me, I m very sorry about the confusion, now all I want are working well... Anyway, I couldn t find these in the documentation, I only find the
            Message 5 of 6 , Sep 4, 2006
            • 0 Attachment
              Hi Tavis,

              Excuse me, I'm very sorry about the confusion, now all I want are
              working well...
              Anyway, I couldn't find these in the documentation, I only find the
              following recomendation:

              >
              > These are not $placeholders but are treated as literal text:
              >
              > $@var $^var $15.50 $$
              >

              Should the docs be updated?
              Thanks for help!

              --
              Michel Thadeu Sabchuk
              Curitiba - Brasil

              -------------------------------------------------------------------------
              Using Tomcat but need to do more? Need to support web services, security?
              Get stuff done quickly with pre-integrated technology to make your job easier
              Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
              http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
              _______________________________________________
              Cheetahtemplate-discuss mailing list
              Cheetahtemplate-discuss@...
              https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
            • Tavis Rudd
              it s in the first section of chapter 5. Cheers, Tavis ... Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with
              Message 6 of 6 , Sep 4, 2006
              • 0 Attachment
                it's in the first section of chapter 5.
                Cheers,
                Tavis

                On Monday 04 September 2006 5:33 am, michelts wrote:
                > Hi Tavis,
                >
                > Excuse me, I'm very sorry about the confusion, now all I want are
                > working well...
                > Anyway, I couldn't find these in the documentation, I only find the
                >
                > following recomendation:
                > > These are not $placeholders but are treated as literal text:
                > >
                > > $@var $^var $15.50 $$
                >
                > Should the docs be updated?
                > Thanks for help!

                -------------------------------------------------------------------------
                Using Tomcat but need to do more? Need to support web services, security?
                Get stuff done quickly with pre-integrated technology to make your job easier
                Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
                http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
                _______________________________________________
                Cheetahtemplate-discuss mailing list
                Cheetahtemplate-discuss@...
                https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
              Your message has been successfully submitted and would be delivered to recipients shortly.