How to display a field in multiple places ?

  • Published by
    George Papadakis
  • Last modified
    28 November 2017
  • Up to date
    Yes
  • Profile concerned
    End user, Webdesigner, Developer
  • Since Version
    2.0
  • Voting
    Average rating
    1 vote
    • 1
    • 2
    • 3
    • 4
    • 5
  • Favourites
    635 How to display a field in multiple places ? /documentation/tutorials-english/69-templating-module-plugin-content/635-how-to-display-a-field-in-multiple-places.html
  • Tags
    designer, developer

It is possible to display a field multiple times, but for the UI drag and drop placement in layout positions does not allowed it
- that is because
some fields include HTML tag ID , thus the proper is to add them only once,
e.g. image field, the gallery JS might have issue if you display the field multiple times

For checkbox(image), radio(image) , etc fields, you will not have such an issue
- do like this:
1. add the field into render only position
2. Inside the PHP code:
item(_hml5).php
category_items(_hml5).php

add in multiple places a line like this:
echo $item->fields->display;

e.g. you can add it before or after the "foreach"  loop of a layout position
- be careful not to break PHP syntax (you can select all file text and backup it and then if you see PHP syntax error then undo the change and re-add code more carefully)