Questions tagged [number]
The number tag has no usage guidance.
17
questions
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!
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="...
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 ...
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, ...
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 ...
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 - ...
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 = [...
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 ...
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 ...
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.
{%...
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 ...
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) ...
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 ...
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?
5
votes
4
answers
3k
views
Price Formatting
I'm outputting prices in a channel with a little formatting like so:
£{{ entry.priceFrom|number_format(2,'.',',') }}
Gives me £1,000.00 or £99.99 etc... However client isn't a fan of the ...
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?
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>
...