Smarty in_array value
I have an array like this
{
"sCode":"05",
"sCodeName":"critical_tight_connection",
"iSeverity":1,
"aData":{
"iLevelOfDetailt":2,
"iDuration":35,
"sLabel":"Labai trumpas pers\u0117dimas, 35 min.",
"sLink":""
}
}
I print it using smarty (array is not serializable, I did this for your convenveniece)
{if !empty( $aSegment.aNotices.aStop )}
<ul>
{foreach from=$aSegment.aNotices.aStop item=aNotice}
<li>
<img class="{$aNotice.sCodeName}" />
{$aNotice.sLabel}
</li>
{/foreach}
</ul>
{/if}
how to check with smarty if "05" exists in aNotices.aStop.sCode? (before the foreach loop)
Tried this
{if in_array('05', $aSegment.aNotices.aStop)}
exist
{/if}
+3
source to share