Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted August 27, 20186 yr I am using img src as the value in checkbox value field, as i want to display image than text ... and i am even using $vlaue|raw but still it would print html code than image... please see screenshot below how to get image instead ....
August 27, 20186 yr So the field type is checkbox? And what are the checkbox options exactly? You probably don’t want to make the options itself full HTML tags. Instead you just take the URL like “iataMeta.png” or just “iataMeta” and then construct the rest outside the $value in the custom output field. All HTML posted there will actually render as HTML.
August 28, 20186 yr Author 8 hours ago, opentype said: So the field type is checkbox? And what are the checkbox options exactly? You probably don’t want to make the options itself full HTML tags. Instead you just take the URL like “iataMeta.png” or just “iataMeta” and then construct the rest outside the $value in the custom output field. All HTML posted there will actually render as HTML. Yes correct it's checkbox.. I have tried URL alone with img src in 'custom' but it only works if there is one option otherwise it will render all selected options in img tag since $value contain all the 'selected' options if there are 2-3 options selected for a single option it solves the problem ... since it's comma separated ... i have tried foreach loop but it does not work ... I will post code here. If two options selected <img src="https://fdir.co/stuff/meta/iataMeta.png, https://fdir.co/stuff/meta/iataMeta.png" height="20"> can there a for each loop for it ... so each selected option is rendered than get in src comma seperated?
August 28, 20186 yr Still not perfectly clear what you are doing, but have a look at this: https://www.opentype.space/superdocs/ips-community-tips/pages/multi-color-select-box-badges-with-pages-r16/ It explains how to deal with multiple values in the Pages custom display fields. For a different use, but the code might be helpful still.
August 28, 20186 yr Author @opentype Thanks, btw, I got to explore your work! i profoundly loved it ... Great Job!
January 23, 20196 yr Author @opentype btw, this code is not working. I hope you get it.. i am trying to display each option value in <li> I had taken it from your website. {{$items=explode(',',$formValue);}} <ul> {{foreach $items as $item}} <li>{{$item}}</li> </ul> {{endforeach}}
January 23, 20196 yr Author 1 hour ago, iJeff said: @opentype btw, this code is not working. I hope you get it.. i am trying to display each option value in <li> I had taken it from your website. {{$items=explode(',',$formValue);}} <ul> {{foreach $items as $item}} <li>{{$item}}</li> </ul> {{endforeach}} fixed with your method looping through each, i was expecting above code to work though 🙂
January 23, 20196 yr I presume the problem with the above code is that you close the unordered list before the first loop. It should be closed after the looping has ended.
January 23, 20196 yr Author 45 minutes ago, Meddysong said: I presume the problem with the above code is that you close the unordered list before the first loop. It should be closed after the looping has ended. Good catch! but that wasn't the problem, i even removed <ul> instead used <span> but to no avail, i had to loop each of them as in above article of opentype.
January 23, 20196 yr When you want to output a variable, then you only need to surround it by single brackets. If you want to evaluate an expression (such as an if statement, foreach, endforeach, assigning a variable, etc.) then you need to use two brackets. {{$items=explode(',',$formValue);}} <ul> {{foreach $items as $item}} <li>{$item}</li> {{endforeach}} </ul>
January 23, 20196 yr Author 36 minutes ago, Ryan Ashbrook said: When you want to output a variable, then you only need to surround it by single brackets. If you want to evaluate an expression (such as an if statement, foreach, endforeach, assigning a variable, etc.) then you need to use two brackets. {{$items=explode(',',$formValue);}} <ul> {{foreach $items as $item}} <li>{$item}</li> {{endforeach}} </ul> Thanks worked. Also learned something new.
Archived
This topic is now archived and is closed to further replies.