How to Add a Backend Preview Thumbnail for Image Fields in Your CMS Made Simple News Modules

Written by Nic Bug Wednesday, 2 May 2012

If you want to have a nice backend preview of the uploaded images in your CMS Made Simple news entries, you need to do the following:

1. Create a new Field Definition named “Image” and type File in News Module:

2. Create a new folder structure in your CMSMS root directory called “module_custom/News/templates” like this:

3. Copy “editarticle.tpl” from modules/News/templates over to our new templates folder.

4. Find this code:

{if isset($custom_fields)}
  {foreach from=$custom_fields item='field'}
    <div class="pageoverflow">{$field->prompt} {$field->field}</div>
  {/foreach}
{/if}

And replace it with this one:

{if isset($custom_fields)}
  {foreach from=$custom_fields item='field'}
    {$field->prompt}{$field->field}
    {if $field->prompt == "Image"}
        {if $smarty.get.m1_articleid}<br/><img width="100" src="../uploads/news/id{$smarty.get.m1_articleid}/{$field->field|replace:"&nbsp;<input":"\"/><!--"} -->
        {/if}
    {/if}
  {/foreach}
{/if}

Now, the uploaded image will be displayed in a small size below the upload field!

This concludes how to add a backend preview thumbnail for your image fields in your CMS Made Simple news modules.

Looking for quality CMS Made Simple Hosting? Look no further than Arvixe Web Hosting!


Leave a Reply






+ one = 3