• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Use JMFilePicker in the News Module
PostPosted: Fri Feb 12, 2016 4:11 am 
Offline
Power Poster
Power Poster

Joined: Mon Jan 21, 2008 5:51 pm
Posts: 961
Location: MI
As I went to setup a live example I noticed that even though the function is written in module it hasn't been registered in Smarty (I should have paid more attention when testing). So until the next version you will need a UDT wrapper.

Add a new Field Definition to the News Module of type "Text Input"

Create an UDT named "JMFP" with the following code:
Code:
if($jmfp = cmsms()->GetModuleInstance('JMFilePicker'))
{     
      echo $jmfp->CreateFilePickerInput( $jmfp, $params['id'],$params['name'], $params['value'], $params, $params['returnid'] );
}


Copy the editarticle.tpl from /modules/News/templates and paste it in /module_custom/News/templates.

Edit /module_custom/News/templates/editarticle.tpl and replace line 184 with the following code:
Code:
                {if $field->prompt == 'FIELDNAME'}
                    {JMFP name=$field->nameattr value=$field->value dir='YOURDIR' }
                    {if !empty($field->value)} {$delete_field_val} <input type="checkbox" name="{$field->delete}" value="delete" />{/if}
                {elseif $field->type == 'textbox'}

For more params for the JMFP call read the JMFilePicker help.

Replace the FIELDNAME with the name of the Field Definition you created above.
Replace the YOURDIR with the directory you want to list/start at relative the /uploads/

In your detail template (you will have to adjust for the summary template) replace lines 115-117
Code:
        {else}
          {$field->name}:&nbsp;{$field->value}
        {/if}

with
Code:
        {elseif $field->name == 'FIELDNAME'}
            <img src="{uploads_url}/YOURDIR/{$field->value}"/>
        {else}
          {$field->name}:&nbsp;{$field->value}
        {/if}

Replace the FIELDNAME and YOURDIR as you did with editarticle.tpl.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting