I am trying to iterate over an array called $module_content
in Smarty/php.
When a certain condition is fulfilled, I want to assign a value to this.
Dont know why, but my approach does not work.
{php}
global $module_content;
$nopic = "./images/nopic.jpg";
for ($i=0;$i<count($module_content);$i++) {
if ($module_content [$i]['PRODUCTS_IMAGE'] == '') {
$module_content [$i]['PRODUCTS_IMAGE'] = $nopic;
}
else {
if (!file_exists ($module_content [$i]['PRODUCTS_IMAGE']) )
$module_content [$i]['PRODUCTS_IMAGE'] = $nopic;
}
}
{/php}
The Smarty-Template prompts the var PRODUCTS_IMAGE within an iteration.
{foreach name=aussen item=module_data from=$module_content}
<img src="{$module_data.PRODUCTS_IMAGE}" alt="" />
{/foreach}
Any help appreciated...
Thank you, in advance.