inherit
tunesrcoolii@gmail.com
86185
0
Oct 3, 2013 8:48:20 GMT -8
tunescool
4,399
August 2006
tunescool
|
Post by tunescool on Apr 14, 2013 17:04:17 GMT -8
how can i get this to display a 0 if there are no likes
<td class="threadlikes" style="padding-right: 0px; font-size:12px; font-weight:bold; font-style:italic; color: #00138E;">{if $[thread.first_post.likes.total]}$[thread.first_post.likes.total] Like{if $[thread.first_post.likes.total] != 1}s{/if}{/if}</td>
|
|
#00AF33
Bark Different.
102833
0
1
Feb 12, 2023 16:57:46 GMT -8
RedBassett
I'm a Marxist/Lennonist of the Groucho/John variety.
15,405
April 2007
applecomputer
RedBassett's Mini-Profile
|
Post by RedBassett on Apr 14, 2013 18:21:48 GMT -8
What happens if you remove "{if $[thread.first_post.likes.total]}" and it's closing "{/if}"?
|
|
inherit
tunesrcoolii@gmail.com
86185
0
Oct 3, 2013 8:48:20 GMT -8
tunescool
4,399
August 2006
tunescool
|
Post by tunescool on Apr 14, 2013 19:28:25 GMT -8
that made them all 0 Likes but i want it just 0 or 1 Like. this is what i have now
<td class="threadlikes" style="padding-right: 0px; font-size:12px; font-weight:bold; font-style:italic; color: #00138E;">$[thread.first_post.likes.total]{if $[thread.first_post.likes.total] != 0}{/if} Like{if $[thread.first_post.likes.total] != 1}s{/if}</td>
|
|
inherit
191470
0
Jan 16, 2018 6:04:59 GMT -8
- TuGs
180
March 2013
tugz
|
Post by - TuGs on Apr 17, 2013 8:47:31 GMT -8
is that how you want it? from the code you posted? or somthing else?
|
|
inherit
tunesrcoolii@gmail.com
86185
0
Oct 3, 2013 8:48:20 GMT -8
tunescool
4,399
August 2006
tunescool
|
Post by tunescool on Apr 17, 2013 9:28:15 GMT -8
i want it to just have 0 without likes and 1 like, 2 likes, 3 likes, etc..
|
|
#00AF33
Bark Different.
102833
0
1
Feb 12, 2023 16:57:46 GMT -8
RedBassett
I'm a Marxist/Lennonist of the Groucho/John variety.
15,405
April 2007
applecomputer
RedBassett's Mini-Profile
|
Post by RedBassett on Apr 17, 2013 9:41:53 GMT -8
What is this part for?
{if $[thread.first_post.likes.total] != 0}{/if}
|
|
inherit
tunesrcoolii@gmail.com
86185
0
Oct 3, 2013 8:48:20 GMT -8
tunescool
4,399
August 2006
tunescool
|
Post by tunescool on Apr 17, 2013 10:17:17 GMT -8
im not sure i was just throwing stff in there
|
|
#00AF33
Bark Different.
102833
0
1
Feb 12, 2023 16:57:46 GMT -8
RedBassett
I'm a Marxist/Lennonist of the Groucho/John variety.
15,405
April 2007
applecomputer
RedBassett's Mini-Profile
|
Post by RedBassett on Apr 17, 2013 10:21:02 GMT -8
Looking at it, I think the above part isn't doing anything, so you can remove that. Can you link to a location where this segment of code is in use, preferably a thread with posts liked 0, 1, and 2 times?
|
|
inherit
191470
0
Jan 16, 2018 6:04:59 GMT -8
- TuGs
180
March 2013
tugz
|
Post by - TuGs on Apr 17, 2013 10:21:39 GMT -8
<td class="threadlikes" style="padding-right: 0px; font-size:12px; font-weight:bold; font-style:italic; color: #00138E;">$[thread.first_post.likes.total] {if $[thread.first_post.likes.total] > 1}Likes {elseif $[thread.first_post.likes.total] > 0}Like {else} {/if}</td>
|
|
#00AF33
Bark Different.
102833
0
1
Feb 12, 2023 16:57:46 GMT -8
RedBassett
I'm a Marxist/Lennonist of the Groucho/John variety.
15,405
April 2007
applecomputer
RedBassett's Mini-Profile
|
Post by RedBassett on Apr 17, 2013 10:27:59 GMT -8
<td class="threadlikes" style="padding-right: 0px; font-size:12px; font-weight:bold; font-style:italic; color: #00138E;">$[thread.first_post.likes.total] {if $[thread.first_post.likes.total] > 1}Likes {elseif $[thread.first_post.likes.total] > 0}Like {else} {/if}</td> When pluralizing, you usually want zero to be plural: 0 Likes 1 Like 2 Likes 3 Likes … So {if $[thread.first_post.likes.total] != 1}s{/if} would be the most efficient notation.
|
|
inherit
191470
0
Jan 16, 2018 6:04:59 GMT -8
- TuGs
180
March 2013
tugz
|
Post by - TuGs on Apr 17, 2013 10:30:12 GMT -8
he want 0 to be on its own :S
|
|
inherit
tunesrcoolii@gmail.com
86185
0
Oct 3, 2013 8:48:20 GMT -8
tunescool
4,399
August 2006
tunescool
|
Post by tunescool on Apr 17, 2013 10:31:21 GMT -8
thanks tugs
|
|
#00AF33
Bark Different.
102833
0
1
Feb 12, 2023 16:57:46 GMT -8
RedBassett
I'm a Marxist/Lennonist of the Groucho/John variety.
15,405
April 2007
applecomputer
RedBassett's Mini-Profile
|
Post by RedBassett on Apr 17, 2013 10:33:06 GMT -8
he want 0 to be on its own :S Good catch! I was not understanding that from the earlier posts.
|
|
inherit
I need a new CT, thinking.... [insert Jeopardy theme song here]
110769
0
Aug 21, 2021 0:07:21 GMT -8
Tumbleweed
20,825
September 2007
tumbleweed
|
Post by Tumbleweed on Apr 21, 2013 11:29:05 GMT -8
When pluralizing, you usually want zero to be plural: 0 Likes 1 Like 2 Likes 3 Likes It would drive me nuts if it didn't show the proper plurals, as you said RedBassett. (I could have just "liked" your post but then you'd not know what I was liking.) lol
|
|
#e61919
1
0
1
Sept 28, 2023 13:31:20 GMT -8
VS Admin
20,147
January 2000
admin
|
Post by VS Admin on Apr 23, 2013 15:14:35 GMT -8
If you just want to output how many likes there are for the first post, all you need is to put $[thread.first_post.likes.total].
|
|