Questions tagged [math]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3
votes
1answer
65 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 - ...
1
vote
1answer
42 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 ...
3
votes
1answer
109 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 ...
2
votes
2answers
5k 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 ...
0
votes
1answer
124 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 ...
2
votes
1answer
640 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 ...
0
votes
1answer
131 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 ...
3
votes
2answers
165 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'...
1
vote
2answers
269 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 ...