문제

Hi I am trying to make code for array in php but didn't get any solution please help me

{ if !in_array($productgroup.gid,array(69,68,27,31,70,71,72,73,74,75,76,77,{php}echo $cid;{/php})) }

<option value="{$productgroup.gid}"{if $gid eq $productgroup.gid} selected="selected"{/if}>{$productgroup.name}</option>

{/if}
도움이 되었습니까?

해결책

Are you trying to create array in PHP? Then:

PHP

$smarty->assign('cid', array(69,68,27,31,70,71,72,73,74,75,76,77));

Smarty

{ if !in_array($productgroup.gid, $cid) }
    ...
{/if}


Or you want add dynamic element in your array? Then:

PHP

$smarty->assign('cid', $some_number);

Smarty

{ if !in_array($productgroup.gid,array(69,68,27,31,70,71,72,73,74,75,76,77,$cid)) }
    ...
{/if}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top