Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [number]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
44 views

start ordered list with number 2

How do I start an ordered list inside a new text block with the number 2 (or any number not 1). I need this trick when a long ordered list is broken up by multiple image blocks. Thanks!
user avatar
1 vote
1 answer
19 views

Getting all images urls and help with numbers field

I have two problems with CraftCMS :( First one - I want to make images gallery and now using something like this: {% set image = entry.car_photos[0] %} {% if image %}<div class="...
user avatar
1 vote
2 answers
24 views

Getting an zero index and count for an entry list

I currently have an entries field which outputs a list of related entries on page. I'm trying to find a way to display two values for these entries. The first would be a zero index. I'm trying to ...
user avatar
  • 245
1 vote
1 answer
80 views

Feed Me import from CSV ignores decimal point

I use Feed Me to import values from a .csv file into my entries. Since a day i have an issue i can't explain. I didn't change anything. Precisely, the issue concerns a number field. In the .csv file, ...
user avatar
  • 213
1 vote
1 answer
58 views

Number field when empty and value=0

Is there a way to differentiate the number field value empty and 0? I would like to display this field only when there's a value in the field even though the value is 0. But when I input 0 into ...
user avatar
3 votes
1 answer
143 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 - ...
user avatar
0 votes
1 answer
39 views

Replace quotes in an array

I'm trying to use a charting library within a Craft template. The chart expects an array of numbers that I'm building up from a table but I'm getting an array of strings instead. {% set donutData = [...
user avatar
  • 1,733
1 vote
1 answer
171 views

Non-numeric characters in number field producing errors

Craft 3 is giving me this error when my client enters non-numeric characters into a number field on an entry: number_format() expects parameter 1 to be float, string given Is there a way for it to ...
user avatar
0 votes
2 answers
417 views

Searching Number Field To See If It Falls In A Range

I'm building a property search form and searching by different types of fields in Craft. Here are my questions: How can I get a list of the unique cities in the entries section to declare my form ...
user avatar
0 votes
1 answer
76 views

Display children's order numbers

I thought this was going to be easy; showing the order number of children against their parent, but the only answer I can find is in this thread and I'm unsure how to implement this into my code. {%...
user avatar
  • 598
1 vote
2 answers
128 views

Sum up number fields in the loop

I don't understand what's going on in my code logic because I'm getting unexpected output. I'd like to sum up three number fields in entries loop for the given post date range. Output gets almost ...
user avatar
3 votes
1 answer
220 views

Calculating a score based on a drop down field value

I am storing a value (number 1-5) in a drop down field and would like to do a calculation based on the numbers filled in. The only way I could get my calculation to work was to store the number (1-5) ...
user avatar
  • 836
1 vote
1 answer
92 views

Unable to sort large number of blocks in Matrix field in CP and template

I have about 145 blocks in a single Matrix. If I try and re-arrange (drag&drop) the first few blocks, and then hit save, all is well. However, trying to re-arrange the last few blocks doesn't save ...
user avatar
0 votes
1 answer
255 views

Can I create a number with decimal point in number field?

Could number for example 7.5 be created in number field?
user avatar
5 votes
4 answers
3k views

Price Formatting

I'm outputting prices in a channel with a little formatting like so: &pound;{{ entry.priceFrom|number_format(2,'.',',') }} Gives me £1,000.00 or £99.99 etc... However client isn't a fan of the ...
user avatar
  • 854
1 vote
2 answers
403 views

How to check if number is prime?

How do I check if a given number is prime in twig?
user avatar
  • 2,332
12 votes
8 answers
21k views

How would I omit zero value decimals in a number format?

Say I have {{ item.width }} and {{ item.height }} which are number fields with 2 decimal places. In my template I have this: <p>Dimensions: {{ item.width }} x {{ item.height }} in.</p> ...
user avatar
  • 1,661