Customer Portal

Get Involved. Join the Conversation.

Topic

    Nisar
    "$" Not Supported in Production Mode?Answered
    Topic posted March 19, 2015 by NisarBronze Crown: 15,000+ Points 
    213 Views, 6 Comments
    Title:
    "$" Not Supported in Production Mode?
    Content:

    I'm experiencing certain strange behavior on the CP while using the $ symbol in a view. I've a page (view) which shows some information in a tabular format. In one row, I have the following line of code:

    <tr>
        <td>Fee:</td>
        <td>$40</td>
    </tr>
    

    On viewing the page in Development mode, the output is as expected. I see the word "Fee: " and "$48" beside it. But upon Staging and Promoting, the same page is showing a different output.

    I can see the word "Fee: ", but "$40" doesn't get printed on the screen. On viewing the source code of the page, I found out that "$40" is skipped altogether. I see the following lines in the page source

    <tr>
        <td>Fee:</td>
        <td></td>
    </tr>
    

    If, however, I remove the $ from "$40" and then Stage and Promote the page and then view in Production mode, "40" is then visible on the screen.

    This makes me wonder if there is an issue with the use of $ on the CP. Is it some kind of a reserved character or does it get escaped/removed by the parser automatically? And what could be the reason that $ works in Development mode, but not in Production mode?

    Best Comment

    Nisar

    Hi Barrilito,

    Thanks for the clarification. Though the exact reason for this behavior isn't clear yet, I managed to overcome it by assigning "$48" as a variable in the controller and passing it to the view.

    Using "&#36;"also worked. So just in case anyone else is having a similar issue, they can opt for either of the methods.

    Comment

     

    • Barrilito van Dijk

      Hi Arun,

      That seems weird. Perhaps it is in the optimization to the production area. Is  it an option to replace it by &#36; perhaps?

      Regards!

    • Nisar

      Hi Barrilito,

      Thanks for the clarification. Though the exact reason for this behavior isn't clear yet, I managed to overcome it by assigning "$48" as a variable in the controller and passing it to the view.

      Using "&#36;"also worked. So just in case anyone else is having a similar issue, they can opt for either of the methods.

    • Barrilito van Dijk

      Hi Arun,

      Good to hear that you got things working. Sometimes you can better stop the effort in thingking "why" something does not work and better choose the alternative way as some things are just outside your limited area of influence.

      Regards!

    • Anuj Behl

      Hi Arun,

      I think the php compiler thought of it as a variable with name 40. So, when it tries to get the value of that variable $40, it finds nothing and null is printed. Just my thought.

      -Anuj

    • Nisar

      Hi Anuj,

      I doubt it since $40 wasn't enclosed within the "<?php .. ?>" tags. But who knows, you could be right too :)

    • Barrilito van Dijk

      I doubt it too. But then again, if you misplace a closing tag of php somewhere it could be an issue.

      Anyhow, you solved it or have used a workaround. And the main issue I think is the difference between development mode and production mode, that should be the same, that worries me more. Sometimes you never realy know what causes it.

      Regards,