Joomla // Display fields in modules

// list of the fields by name $ChampsPerso = array( 'logo', 'slogan' ); // list of the fields by id (same order as above) $ChampsPersoID = array( '1', '2' ); $model = JModelLegacy::getInstance('Field', 'FieldsModel', array('ignore_request' => true)); $Fields = $model->getFieldValues($ChampsPersoID, $item->id); // Set the field name as key for an easier code $Field=array(); $y=1; while ( $y<= count($Fields)) { $Field[$ChampsPerso[$y]]=$Fields[$y]; $y++; } echo $Fields['logo']; echo $Fields['slogan'];
Snippets to display articles custom fields in module (in my example : mod_articles_category).
You have to decide which fields to load.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.