# O|Developer's Guide # Custom Fields Display ## Overview To display a custom field or a custom field group inside the layouts, use this schema. ## ITEM VIEW #### Display single custom field: ```php item->fields->getOne(ID)->show();?> ```
Where "5" is the ID of the custom field. ID's can be found under custom fields list, the last column. #### Display a group: ```php item->fields->showGroup("item")?> ```
Where "second" is the name of the group
itemviews/item
itemsviews/items
tabsviews/itemunder the custom tabs
featuresviews/itemunder features tab
#### Display all: ```php fields->show()?> ```
# Custom Fields Templates ### Custom Fields Templates Custom Fields display is being handled by the templates. Before you start some basic HTML/CSS skills are needed. Templates are located under the component templates directory path: ```bash components/com_jomcomdev/templates/fields ```
By default there are 3 custom field templates: - default.php \[vertical\] - horizontal - horizontal-float When edited structure looks like this: ![](https://wiki.comdev.eu/download/attachments/4194596/ScreenShot062.jpg) You can use any HTML structure and style using the component CSS files.
Custom Field styles are located in main component CSS file: assets/css/jomdirectory.css #### Set Custom Field Template To assign a template to a custom field, edit custom field in component backend under Custom Fields, then just choose the desired template: ![](https://wiki.comdev.eu/download/attachments/4194596/ScreenShot063.jpg) #### Create a New Custom Field Template Just copy one of the current templates, change name and edit. The new template appears under Custom Field Template. You'll also need to create a corresponding translation in language file: components\\com\_jomcomdev\\language \\en-GB\\en-GB.com\_jomcomdev.ini change "en\_GB" in path to match your language. # Forms ### Overview Forms used inside JomDirectory are XML based so can easily be edited. Location of the XML files: components/com\_jomdirectory/models/forms Each file name describes where is being used in the component front-end e.g. addreviews.xml is used for adding a review under item view. #### Edit You can edit these files and insert more fields if needed. There are Joomla based field types: text, text area, radio etc. Please read Joomla documentation for more types. For each new field, a database column needs to be created. #### Display Form fields are being parsed by the model to the template file e.g. views/item/default.php To display the field, use this schema: ```php form->getLabel('title'); ?> form->getInput('title'); ?> ```