On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hi

    I would like to display a value on page which is simply two TVs added together.

    I have a TV called initialpayment and another called finalpayment.  I want to add them together and display on a page.

    I’ve never used PHX before.  I’m assuming this is a job for PHX?  I suspect I’m stuck on the syntax.  I’ve tried about a hundred variations can’t seem to get it right.  I get either a parse error or no value is displayed.  Can someone show me how its done?

    Here’s the latest I’ve tried.

    • This will work. I hope smiley

      • 0x7B

        Thanks for responding so quickly.

        Here’s what I get with your example.

        Parse error: syntax error, unexpected T_DNUMBER, expecting T_VARIABLE or ’$’ in /home/xxxxxxx/public_html/assets/plugins/phx/phx.parser.class.inc.php(266) : eval()’d code on line 1
        • Hi Chris,

          i checked it out. created 2 Tvs . added them. it worked as expect.



          I haven’t got a clue why it is not working.
          Do you got any orphan tags or backticks somewhere in your content?

          • 0x7B

            You were right on. Turns out the TVs contain $50.00 and $250.00 rather than pure numeric values.

            Once I removed those $s, worked like a charm!

            Thank you!
            • Hi Guys,
              Any idea how u would add fields in Migx together. Say I have a field "number". I would like the user to add as many rows with values they want and at the end it would be totalled.
              • for revo I did this. may help someone

                <script type="text/javascript">
                sum = function(o){
                	for(var s = 0, i = o.length; i; s += o[--i]);
                	return s;
                var x = [ [[!getImageList? 
                  `]] ];

                where num is a tv usd in migx holding a numerical value.

                • In Evo 1.0.3, and inside Ditto is there any way to adapt the example to use placeholders instead of TVs?


                  Replacing the * by + does not work.
                  I tried to disable PHx as I read there is already built-in PHx in Ditto.