[[getImageList? &tvname=`Position_Item` &tpl=`@CODE:
<div class="">
[[+content:notempty=`
[[+content]]
`]]
[[+btn_text:!empty=`
[[+btn_text]]
`]]
</div>
`]]
if I check like a regular tv field it doesn’t show. I know the &toPlaceholder
parameter but I need to check every element in MIGX.
Just to be sure, you are using a regular TV with the input type set to MIGX?
Try using a chunk with your template code instead of the inline @code
. In general your setup looks fine to me, but I had similar issues before when using tag modifiers like :notempty
within an inline tpl segment.
try to use a real tpl-chunk or replace [[
and ]]
with {{
and }}
but why do you check, if empty at all? If the value is empty, it wouldn’t output anything, so you don’t need the check.
@bruno17
sorry, it doesn’t work even if I use real tpl. Could you please try on your machine?
And I need this because of a lot of elements, especially buttons. see the example below
[[getImageList? &tvname=`carousel` &tpl=`@CODE:
<div class="">
<div class="mb-5">
<img src="[[+image]]"
width="64" height="62" alt="icon">
</div>
<h4 class="mb-5">[[+title]]</h4>
<p>[[+description]]</p>
<a href="[[+btn_link]]" class="btn btn-secondary-outline sm:text-lg border-2 mt-6">
[[+btn_text]]
</a>
</div>
`]]
what exactly doesn’t work with this example?
@bruno17
I need to show each migx field conditionally. If the value has been entered, the field will display. See the button
[[getImageList? &tvname=`carousel` &tpl=`@CODE:
[[+btn_text:notempty=`
<a href="[[+btn_link]]" class="btn btn-secondary-outline sm:text-lg border-2 mt-6">
[[+btn_text]]
</a>
`]]
`]]
If an actual template chunk doesn’t work, have you double-checked your spelling of field tags, etc.? Maybe share your formtabs input. Also do you have any other migx tvs working?
@vibedesign you made my day. Now it’s lucky working but earlier didn’t work.
@vibedesign
is this possible to display conditionally?
[[getResourceField:!empty=`
<a href="" class="btn btn-primary">
[[getResourceField? &id=`3` &field=`fc_phone_number` &processTV=`1`]]
</a>
` &id=`3` &field=`fc_phone_number` &processTV=`1`]]
Generally yes, I think this should work.
Although it’s hard to say if getResourceField
is the best option here without knowing more details. I would probably go for pdoField (part of the pdoTools extra) here as it allows for the output to be set to a placeholder:
[[pdoField?
&id=`3`
&field=`fc_phone_number`
&toPlaceholder=`yourOutput`
]]
[[+yourOutput:!empty=`
<a href="" class="btn btn-primary">
[[+yourOutput]]
</a>`
]]
Honestly I don’t know about performance differences here, just personal preference.
I believe you are missing a ?
before &id=`3`
.
[[getResourceField:!empty=`
<a href="" class="btn btn-primary">
[[getResourceField? &id=`3` &field=`fc_phone_number` &processTV=`1`]]
</a>
`? &id=`3` &field=`fc_phone_number` &processTV=`1`]]
@halftrainedharry great you are. It’s working perfectly.