Smarty in_array Wert
Habe ich array wie folgt
{
"sCode":"05",
"sCodeName":"critical_tight_connection",
"iSeverity":1,
"aData":{
"iLevelOfDetailt":2,
"iDuration":35,
"sLabel":"Labai trumpas pers\u0117dimas, 35 min.",
"sLink":""
}
}
ich Schreibe ihn mit smarty (array werden nicht serialisiert, ich hab es getan hat für Ihre conveniece)
{if !empty( $aSegment.aNotices.aStop )}
<ul>
{foreach from=$aSegment.aNotices.aStop item=aNotice}
<li>
<img class="{$aNotice.sCodeName}" />
{$aNotice.sLabel}
</li>
{/foreach}
</ul>
{/if}
prüfen wie man mit smarty, wenn '05' existieren in aNotices.aStop.sCode ? (vor der foreach-Zyklus)
Versucht, diese
{if in_array('05', $aSegment.aNotices.aStop)}
exist
{/if}
Vielleicht
Nein, das ist nicht richtig.
{php}
und {/php}
um die if-Anweisung hilft.Nein, das ist nicht richtig.
InformationsquelleAutor MyMomSaysIamSpecial | 2013-01-18
Du musst angemeldet sein, um einen Kommentar abzugeben.
diese :
{if $smarty.session.user.group|in_array:['admin','broker']}
InformationsquelleAutor Jeff Bic
Meinst du so etwas?
InformationsquelleAutor hek2mgl
Danke hek2mgl und Jeff Bic, geändert, Ihre Antworten und das funktioniert gut :
InformationsquelleAutor MyMomSaysIamSpecial