Custom field example

Discussion in 'Developing, APIs and extending' started by molnar.jozsef, May 7, 2012.

  1. molnar.jozsef

    molnar.jozsef New Member

    Hi!

    Please make a complete example "Hello world!" code, how can we display a custom field in "Admin CP / Templates / Templates / General / customfields"

    HTML:
    ...
    <{if $_customField[fieldtype] == 'custom' && $_customField[valuetype] != 'static'}>
    <!-- PLACE CUSTOM FIELD TYPE HTML CODE HERE -->
    <{else}>
    ...
    But what???

    Fusion v4.40.1079 didn't work on Organisation tab:
    kayak_custom_field_example.png

    Thanks!
  2. jojoworld

    jojoworld Member

    Hello,

    I recommend as a first step to rename the field name like this: "my_custom_field"(recommended if you manage multiple custom fields on a unique template).

    Here's an example:

    Code:
    ....
    <{if $_customField[fieldtype] == 'custom' && $_customField[valuetype] != 'static'}>
        <{if $_customField[fieldname] ==  'my_custom_field'}>
              <tr>
                  <td>URL of your website</td>
                  <td>http://<input type="text" name="<{$_customField[fieldname]}>" value="www.example.com" class="my_own_class" onchange="javascript:...." /></td>
              </tr>
        <{/if}>
    <{else}>
    ....
    Customfield in the example looks like a text field, but with some additions allowing you to have a better presentation and use javascript event.

    Personally, I use it to retrieve a dynamic list with ajax

Share This Page