Skip to main content

Questions tagged [math]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
1 answer
192 views

Math with numeric values derived from a dropdown field

I had a dropdown field with a handle of hLevel, with only numeric values in it, anticipating that I could do math with the values in my template. But it seems I can't. {% set dif = subhead.hLevel - ...
Jonathan Schofield's user avatar
1 vote
1 answer
61 views

Sum of one checkbox field

I have a checkbox field which I want the sum of a certain checkbox: {% set countPremiere = 1 %} {% set iterationPremiere = 0 %} {% set premiereTotal = 0 %} {% for entry in allEntries %} // the ...
KSPR's user avatar
  • 3,788
3 votes
1 answer
161 views

Adding all the Matrix Block field types of the same kind to get a total

I have a Matrix block with a description field and a number field for hours. Let's say while creating an entry I add in 3 of these blocks with each having a different amount for the hours. How can I ...
FortySeven Media's user avatar
3 votes
3 answers
13k views

Total sum within loop

I have simple loop: {% for total in thing %} {{ total.seatsKids }} {{ total.seatsParents }} {% endfor %} This results in a string of numbers eg. 1 3 4. I want the sum of all numbers. So how do I ...
KSPR's user avatar
  • 3,788
0 votes
1 answer
146 views

Minor math in template, display result before logic in DOM

Currently I’m looping through some results on an athlete’s bio page to get their individual win/loss record… Something like {% if matchWon is defined %}{% set wins = wins + 1 %}{% endif %} is looping ...
Chase Giunta's user avatar
2 votes
1 answer
766 views

Is there a logarithm function in Craft or Twig?

I searched the Craft and Twig documentation, although I did not find any information about a logarithm function (http://php.net/manual/en/function.log.php ). I am trying to calculate the loan ...
Angela's user avatar
  • 569
0 votes
1 answer
149 views

Date changing algorithm

Im working on a school website where the client would like a global date that is the start and finish of all the classes. This part is easy as I have made a Global where you enter the Start and End ...
JeffTalbot's user avatar
3 votes
2 answers
190 views

Help developing point system for sports league (w/o plugins)

I'm in the middle of a very long project developing a league site for the National Collegiate Wrestling Association in my spare time (once finished, could be a great showcase for Craft). Currently, I'...
Chase Giunta's user avatar
1 vote
2 answers
406 views

Loop based on date (with math)

I would like to loop through entries only if the current date/time is before 5am on the following day from when the entry's eventDate (custom field mind you)is. In other words I may have an event at ...
Christopher Healey's user avatar