CMS Made Simple Forums
https://forum.cmsmadesimple.org/

Module: FEU Uploads custom fields
https://forum.cmsmadesimple.org/viewtopic.php?f=7&t=79024
Page 1 of 1

Author:  blackrain [ Fri Sep 07, 2018 11:25 am ]
Post subject:  Module: FEU Uploads custom fields

I am trying to add custom fields to the uploads module.

I created a custom field (dropdown) and added values. however I am not able to show the value of the dropdown on the front end.

I have tried the usual
\$1:
{$entry->fielddefs->section.value}
{$entry->custom_field->section}

etc..

but no results are shown, any idea what the correct syntax is for this please.

many thanks

Mark

Author:  blackrain [ Fri Sep 07, 2018 1:58 pm ]
Post subject:  Re: Module: FEU Uploads custom fields

I have used this to get me over the issue but I really need to be able to access the individual custom field.

\$1:
{if isset($entry->fields)}
    {foreach name=fields from=$entry->fields key='fldname' item='field'}
         {$field.value}
    {/foreach}
{/if}


if I add more fields the returned data would be concatenated.

Thanks

Author:  PinkElephant [ Sat Sep 08, 2018 3:29 pm ]
Post subject:  Re: Module: FEU Uploads custom fields  Topic is solved

blackrain \blackrain:
access the individual custom field

Installing the module (so much good work here) and using a test-category and couple of field definitions, imaginatively named test-field-definition-01 (text) and test-field-definition-02 (dropdown) and ...

\$1:
   {if isset($entry->fields)}
      <h2>Debug</h2>
      <pre>
         {* print_r($entry->fields) *}

         01 name: {$entry->fields['test-field-definition-01']['name']}
         01 value: {$entry->fields['test-field-definition-01']['value']}

         02 name: {$entry->fields['test-field-definition-02']['name']}
         02 value: {$entry->fields['test-field-definition-02']['value']}
      </pre>
   {/if}


... bingo.

Author:  blackrain [ Mon Sep 10, 2018 8:49 am ]
Post subject:  Re: Module: FEU Uploads custom fields

Thank you @PinkElephant, that works perfectly.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/