Joe Boxer
01-11-2007, 11:20 PM
If a thumbnail is uploaded, it shows up on the link detail page perfectly.
But if no image is uploaded, a broken image is displayed.
How can I adjust the code so that the text ("Image:") and corresponding image are only displayed if an image was uploaded?
Current code is shown below:
<!-- START LINK FIELDS DISPLAY -->
{foreach from=$fields item=field}
{assign var="key" value=$field.name}
<tr>
{assign var="field_name" value='field_'|cat:$field.name}
<td valign="top"><strong>{$lang.$field_name}:</strong></td>
<td>
{if $link.$key || ($link.$key eq '0')}
{if ($field.type eq 'text') || ($field.type eq 'textarea')}
{if $config.html_tags}
{$link.$key}
{else}
{text_html aText=$link.$key}
{/if}
{elseif $field.type eq 'checkbox'}
{array_to_lang values=$link.$key name=$field.name}
{elseif $field.type eq 'storage'}
<a href="{$config.base}{$config.dir}uploads/{$link.$key}">{$lang.download}</a>
{elseif $field.type eq 'image'}
<img src="{$config.base}{$config.dir}uploads/{$link.$key}" width="{$field.image_width}" height="{$field.image_height}" />
{elseif $field.type eq 'combo'}
{assign var="field_combo" value="field_"|cat:$field.name|cat:'_'|cat:$link.$key}
{$lang.$field_combo}
{elseif $field.type eq 'radio'}
{assign var="field_radio" value="field_"|cat:$field.name|cat:'_'|cat:$link.$key}
{$lang.$field_radio}
{/if}
{else}
{$lang.not_available}
{/if}
</td>
</tr>
{/foreach}
<!-- END LINK FIELDS DISPLAY -->
Thanks, Joe
But if no image is uploaded, a broken image is displayed.
How can I adjust the code so that the text ("Image:") and corresponding image are only displayed if an image was uploaded?
Current code is shown below:
<!-- START LINK FIELDS DISPLAY -->
{foreach from=$fields item=field}
{assign var="key" value=$field.name}
<tr>
{assign var="field_name" value='field_'|cat:$field.name}
<td valign="top"><strong>{$lang.$field_name}:</strong></td>
<td>
{if $link.$key || ($link.$key eq '0')}
{if ($field.type eq 'text') || ($field.type eq 'textarea')}
{if $config.html_tags}
{$link.$key}
{else}
{text_html aText=$link.$key}
{/if}
{elseif $field.type eq 'checkbox'}
{array_to_lang values=$link.$key name=$field.name}
{elseif $field.type eq 'storage'}
<a href="{$config.base}{$config.dir}uploads/{$link.$key}">{$lang.download}</a>
{elseif $field.type eq 'image'}
<img src="{$config.base}{$config.dir}uploads/{$link.$key}" width="{$field.image_width}" height="{$field.image_height}" />
{elseif $field.type eq 'combo'}
{assign var="field_combo" value="field_"|cat:$field.name|cat:'_'|cat:$link.$key}
{$lang.$field_combo}
{elseif $field.type eq 'radio'}
{assign var="field_radio" value="field_"|cat:$field.name|cat:'_'|cat:$link.$key}
{$lang.$field_radio}
{/if}
{else}
{$lang.not_available}
{/if}
</td>
</tr>
{/foreach}
<!-- END LINK FIELDS DISPLAY -->
Thanks, Joe