EE 1
EE 2
Will Hunting
Developer
3rd Party (Free)
Download v2.5.7
Compatibility
- LG Addon Updater
- Multi Site Manager
- Stand Alone Entry Form
Requirements
- jQuery for the Control Panel
Tags
Provides a math template tag capable of performing relatively complex mathematical evaluations.
This tag provides class that provides math evaluation can handle relatively complex evaluations, including basic math functions such as round() and rand().
There are two types of tags available: a single tag that evaluates math expressions, and a pair tag that adds a new syntax for evaluation of expressions in-line with other conditional logic.
Single Tag
Basic math:
12 * 12 = {exp:will_hunting solve="12 * 12"}
Generating previous and next integers for custom pagination links from a page parameter (in this case retrieved using Super Globals):
prev_page = {exp:will_hunting solve="{get:page} - 1"}
next_page = {exp:will_hunting solve="{get:page} + 1"}
Tag Pair (slightly experimental)
The tag pair introduces support for a much more friendly syntax, as shown in this example:
{exp:will_hunting:solve_pair}
{$one_fourty_four=12*12}
{$prev_page={get:page}-1}
{$next_page={get:page}+1}
{/exp:will_hunting:solve_pair}
Another example for the experimental syntax, using conditionals to show a fake no results message. Note in this example, x is a custom field on the only weblog in the test instance, and none of the entries have x set to 3.
{exp:will_hunting:solve_pair}
{$count=0}
{$no_results=0}
start count = {$count}
{exp:weblog:entries parse="inward"}
{if no_results}
Real no results!
{$no_results=1}
{/if}
{if x == 3}{
{entry_id} {title}
{$count=$count+1}
{/if}
{/exp:weblog:entries}
count = {$count}
{if {$count} == 0}
{if {$no_results} == 0}
Fake no entries!
{/if}
{/if}
{/exp:will_hunting:solve_pair}
The tag pair also creates a new layer of conditional evaluation which occurs in order along with expression evaluations, at the time that the will_hunting tag is called.
{exp:will_hunting:solve_pair}
{$count=0}
{$count=$count+1}
one = {$count}<br/>
{if {$count} > 1}
Greater than 1 ({$count})!<br/>
{/if}
{$count=$count+1}
two = {$count}<br/>
{if {$count} > 1}
Greater than 1 ({$count})!<br/>
{/if}
{/exp:will_hunting:solve_pair}
Will Hunting also supports future variable references in the form of {%variable_name}. These variables will br parsed as the very last action to allow their final values to be references before they are defined. No further manipulation can be done on the variables at this point.
{exp:will_hunting:solve_pair}
Final %count: {%count}
{$count=0}
{$count=$count+1}
{$count=$count+1}
Last normal count: {$count}
{/exp:will_hunting:solve_pair}
Functions
Will Hunting provides the following functions in addition to basic math operators.
abs(n)
Returns the absolute value of n.
ceil(n)
Returns the next highest integer value by rounding up value if necessary.
floor(n)
Returns the next lowest integer value by rounding down value if necessary.
int(n)
Returns the integer value of n, using base 10 for the conversion.
max(n1,..)
Returns the largest of the provided numbers.
min(n1,...)
Returns the smallest of the provided numbers.
mod(n1, n2)
Performs a mod operation on n1/n2.
rand(n1, n2)
Returns a pseudo-random integer from n1 to n2.
round(n, p)
Rounds n to precision p.
MetaSushi EE Add-ons Newsletter
To stay up to date with the latest ExpressionEngine add-on news from MetaSushi, be sure to subscribe to the MetaSushi EE Add-ons Newsletter today (very low volume).
Download Will Hunting
| EE Version | Downloads | Add-On Version | Release Date |
|---|---|---|---|
| 2.+ | Download | 2.5.7 | 2011-09-15 02:54 PM |
This entry was last updated March 30, 2012, 8:52 am.
Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. Devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!
There are no reviews for this add-on yet.
What are you waiting for? Rate it and review it!