I have a custom link integer field. It usually has a 5 digit number as a value, but I need to only display the first 2. The {LINKCUSTOMFIELD[2]> doesn't work. What can I do to make this happen? Any PHP code to help with something like this?
Let me rephrase. I just realized that I need to trim all the 0 (zeros) from the value to be displayed instead. I can't just display the first 2 or 3 numbers of the value.
So if I have a value of 1500000, I need to trim the zeros from there and display the 15 only. This doesn't mean I need the values changed in the database, but I need to only display the number 15 when calling up this custom link field.
Comments on trim a custom link field
Forum Regular
Usergroup: Customer
Joined: Jun 22, 2005
Total Topics: 91
Total Comments: 305
Hey Paul,
I have a custom link integer field. It usually has a 5 digit number as a value, but I need to only display the first 2. The {LINKCUSTOMFIELD[2]> doesn't work. What can I do to make this happen? Any PHP code to help with something like this?
Much appreciated.
David
Forum Regular
Usergroup: Customer
Joined: Jun 22, 2005
Total Topics: 91
Total Comments: 305
Let me rephrase. I just realized that I need to trim all the 0 (zeros) from the value to be displayed instead. I can't just display the first 2 or 3 numbers of the value.
So if I have a value of 1500000, I need to trim the zeros from there and display the 15 only. This doesn't mean I need the values changed in the database, but I need to only display the number 15 when calling up this custom link field.
Thanks
David
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
<?php echo trim("{LINKCUSTOMFIELD}", "0"); ?>
Actually given the function-calling option of WSN I think {FUNC_TRIM[{LINKCUSTOMFIELD} <,> 0]} should also work.