We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29525
    • 388 Posts
    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.

    <p>[*projectcost:math?`[*initialpayment*]+[*finalpayment*]`*]</p>
      www.terrybarthdesign.com
      • 19667
      • 26 Posts
      This will work. I hope smiley
      [*initialpayment:math=`?+[*finalpayment*]`*]

        • 29525
        • 388 Posts
        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
          www.terrybarthdesign.com
          • 19667
          • 26 Posts
          Hi Chris,

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

          PAGECONTENT
          [*initialpayment*]
          [*finalpayment*]
          [*initialpayment:math=`?+[*finalpayment*]`*]

          RENDERED CONTENT
          5.54
          2.00
          7.54

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


            • 29525
            • 388 Posts
            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!
              www.terrybarthdesign.com
              • 12410
              • 353 Posts
              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.
              Thanks
                • 12410
                • 353 Posts
                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? 
                    &tvname=`mig`
                &outputSeparator=`,`
                    &tpl=`@CODE:[[+num]]
                  `]] ];
                document.write(sum(x));
                
                
                </script>


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

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

                  [*initialpayment:math=`?+[*finalpayment*]`*]

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