Jump to content

IPS Page. Custom Field printing html code than image


iJeff

Recommended Posts

Posted

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 ....505151360_ScreenShot2018-08-27at3_58_26PM.thumb.png.24cbb2cb2ae6b3106ea3145cbaeeedfe.png

 

 

Posted

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. 

Posted
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?

  • 4 months later...
Posted

@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}}

 

Posted
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 🙂

Screenshot 2019-01-23 at 3.18.39 PM.png

Posted
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.

Posted

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>

 

Posted
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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...