ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

New plugins: Will Hunting (math), and Count Entries.

December 07, 2010 4:44pm

Subscribe [7]
  • #16 / Jan 20, 2011 11:24pm

    PixelGrinch

    48 posts

    I can see this coming in handy when splitting entries into multiple columns. I’ve always resorted to PHP parsed as input, but yet that even has it’s limitations and resorting to embed another include.

    That’s exactly what I was trying to do but discovered division doesn’t work even though the plug-in code seems to look for / as well.

  • #17 / Jan 21, 2011 12:41am

    airways

    154 posts

    PixelGrinch,

    Yeah it looks like it should work.  Tomorrow I’ll see if I can figure out what’s going on. Which version are you using? The experimental tag pair or the single solve tag version?

  • #18 / Jan 22, 2011 1:28pm

    PixelGrinch

    48 posts

    Hi Airways,

    I used both versions the most recent single (1.0) and the most recent tag pair (2.2).

    Thanks for the quick response ...

    PixelGrinch,

    Yeah it looks like it should work.  Tomorrow I’ll see if I can figure out what’s going on. Which version are you using? The experimental tag pair or the single solve tag version?

  • #19 / Jan 22, 2011 5:42pm

    airways

    154 posts

    Well I haven’t been able to find a problem with division. The following test works:

    {exp:will_hunting}
    2 + 2 = {$n=2 + 2} {$n}
    
    2 - 2 = {$n=2 - 2} {$n}
    
    2 * 2 = {$n=2 * 2} {$n}
    
    2 / 2 = {$n=2 / 2} {$n}
    
    {/exp:will_hunting}

    I would say double check your tying and if you do still have an issue, post a Bug Report with the offending code at the support forum for the plugin: http://devot-ee.com/add-ons/support/will-hunting/viewforum/1354/

    Good luck!

  • #20 / Jan 22, 2011 6:25pm

    PixelGrinch

    48 posts

    Hi Airways,

    trying the single tag currently installed:

    this being the only code in the complete template:

    12 * 3 = {exp:will_hunting solve="12 * 3"}

    12 + 3 = {exp:will_hunting solve="12 + 3"}

    rund(12.92 + 5) = {exp:will_hunting solve="round(12.92 + 5)"}

    12 / 3 = {exp:will_hunting solve="12 / 3"}


    returns:

    12 * 3 = 36
    12 + 3 = 15
    rund(12.92 + 5) = 18
    12 / 3 = 12

    Maybe I am missing something. If you can’t reproduce this I will post a bug report as you mentioned in your prior post.

    Well I haven’t been able to find a problem with division. The following test works:

    {exp:will_hunting}
    2 + 2 = {$n=2 + 2} {$n}
    
    2 - 2 = {$n=2 - 2} {$n}
    
    2 * 2 = {$n=2 * 2} {$n}
    
    2 / 2 = {$n=2 / 2} {$n}
    
    {/exp:will_hunting}

    I would say double check your tying and if you do still have an issue, post a Bug Report with the offending code at the support forum for the plugin: http://devot-ee.com/add-ons/support/will-hunting/viewforum/1354/

    Good luck!

  • #21 / Jan 22, 2011 7:29pm

    airways

    154 posts

    Okay well, I did finally recreate this in EE 1.7. Doesn’t occur in 2.0, so I am suspecting that it’s a weird parsing error in the Template class… might take awhile, but I will try to track it down.

  • #22 / Jan 22, 2011 7:44pm

    PixelGrinch

    48 posts

    Hi Airways,

    I have clients that hire me to just find bugs 😊, for some reason I have a talent finding them! If there is a bug, I find it, HA!

    Thanks for looking into this. Keep me updated on the status ... Have a great weekend!

    Okay well, I did finally recreate this in EE 1.7. Doesn’t occur in 2.0, so I am suspecting that it’s a weird parsing error in the Template class… might take awhile, but I will try to track it down.

  • #23 / Jan 22, 2011 7:49pm

    airways

    154 posts

    Found it! Actually, I’ve seen this one before. EE 1.x has a habit of changing / into an HTML entity for some reason. This should have occurred to me before, it’s caused more than a few bugs in custom code we’ve written in the past. Anyway, fixed version now up at http://devot-ee.com/site/download/?file=will_hunting-2_3.zip

    This version also brings back single template tags if you need them, with a slightly updated syntax:

    {exp:will_hunting:solve exp="round(12.92 * 1234)" store="x"}
    x = {exp:will_hunting:get var="x"}
  • #24 / Jan 22, 2011 8:03pm

    PixelGrinch

    48 posts

    Nice job mate! A++!

    Found it! Actually, I’ve seen this one before. EE 1.x has a habit of changing / into an HTML entity for some reason. This should have occurred to me before, it’s caused more than a few bugs in custom code we’ve written in the past. Anyway, fixed version now up at http://devot-ee.com/site/download/?file=will_hunting-2_3.zip

    This version also brings back single template tags if you need them, with a slightly updated syntax:

    {exp:will_hunting:solve exp="round(12.92 * 1234)" store="x"}
    x = {exp:will_hunting:get var="x"}
  • #25 / Jan 23, 2011 9:54pm

    PixelGrinch

    48 posts

    Hi Airways,

    I was missing the Modulus (division remainder) operator. As a token of my appreciation for your quick replies and solution, I added ‘%’ support to Will Hunting. Feel free to check it out and integrate it into the next update of Will Hunting.
    I have added a readme.txt file along with the file and it can be downloaded at:

    pi.will_hunting_pg_231.zip

    thanks again for your quick help yesterday, Airways!

    Found it! Actually, I’ve seen this one before. EE 1.x has a habit of changing / into an HTML entity for some reason. This should have occurred to me before, it’s caused more than a few bugs in custom code we’ve written in the past. Anyway, fixed version now up at http://devot-ee.com/site/download/?file=will_hunting-2_3.zip

    This version also brings back single template tags if you need them, with a slightly updated syntax:

    {exp:will_hunting:solve exp="round(12.92 * 1234)" store="x"}
    x = {exp:will_hunting:get var="x"}
  • #26 / Mar 09, 2011 10:14am

    IDF MARKETING

    23 posts

    Nice plugin - but how can you set the deminal places of the result?

    I am using this to calculate the TAX on an item and need to set deminal place to 2 points

    {exp:will_hunting solve="({cart_subtotal} + {cart_shipping} - {cart_discount}) * 0.16666666"}
  • #27 / Mar 09, 2011 10:21am

    IDF MARKETING

    23 posts

    Don’t worry - just modified the plugin file adding in this :

    /**
         *  Evaluate an expression, returning the value
         */
        function evaluate($expr) {
    
            $this->expr = $expr;
            $this->tokenize();
            $this->pos = 0;
            $this->err = array();
    
            $value = number_format($this->eval_expr(),2); //this line was added to format the result as we are only using it for Tax purposes you might need to modify it more if you want to be able to select whether to use this output or not
    
            return $value;
        }
  • #28 / Mar 09, 2011 10:49am

    airways

    154 posts

    Good ideas, I’ll see about adding similar options to the next release.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases