Skip to content
Cristian Grañó edited this page Jan 21, 2016 · 9 revisions

Api for templates

You can create a personal template with the extrafields values. Is very easy and flexible.

First you should add the api library with:

// require helper file JLoader::register('fieldattach', 'components/com_fieldsattach/helpers/fieldattach.php');


Get field with template format

fieldattach::getFieldValue($articleid, $fieldid, $category = false, $write = false)

Parameters $id(Article id)
$fieldsids(field id)
$category, true or false (default false)
$write, true or false (default false)
Return HTML of field


Render all fields to article

fieldattach::getAllFieldValue($articleid, $category = false)

Parameters $id(Article id)
$category, true or false (default false)
(It don't work yet)


Get name

fieldattach::getName($id, $fieldsids, $category=false)

Parameters $id(Article id) $fieldsids(field id) $category (boolean)
Return Value of name of field

Get only value, without format

fieldattach::getValue($id, $fieldsids, $category=false) Parameters $id(Article id) $fieldsids(field id) $category (boolean) Return Value of field, without HTML tags. ONLY for a input, textarea and select extratypes

Clone this wiki locally