Вопрос

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