#158 Posted in ‘Econa’

Latest post by Lefteris Kavadas on Monday, 14 May 2018 12:12 EEST

Alberto Santini
 Hi I need to render the image also in tne mod_articles_category
Hw can I do?

Lefteris Kavadas
Hi,

Which kind of integration are you using? Custom field or Article images?

Regards

Alberto Santini
I'm using Custom field

I'm trying with mod_articles_latest and mod_articles_category ...

Lefteris Kavadas
Unfortunately, the core modules have not been updated yet to display the custom fields. However, you can edit the layout override and add the following code:

$item->jcfields = FieldsHelper::getFields('com_content.article', $item, true);
foreach($item->jcfields as $field) {
    echo FieldsHelper::render('com_content.article', 'field.render', array('field'=> $field));
}


Note that you have to enter this code inside the items loop.
This code will render all custom fields of the item. If you just want to display a single custom field use the following code (again inside the items loop):

$item->jcfields = FieldsHelper::getFields('com_content.article', $item, true);
echo FieldsHelper::render('com_content.article', 'field.render', array('field'=> $item->jcfields[X]));


Replace X with the field ID you want to render.

If you like our extension please post a review at the Joomla extensions directory.

Let us know if you need anything else.

Regards

Alberto Santini

This is my code ... but I receive "Call to a member function get() on null"

defined('_JEXEC') or die;
?>
		
				get('link_titles') == 1) : ?>
					

title; ?>

title; ?>

<?php echo $images->image_intro_alt; ?> displayDate) : ?> displayDate; ?> jcfields = FieldsHelper::getFields('com_content.article', $item, true); echo FieldsHelper::render('com_content.article', 'field.render', array('field'=> $item->jcfields[1])); ?> get('show_introtext')) : ?>

displayIntrotext; ?>

params->get('access-view') == false) : ?> get('show_readmore_title', 0) == 0) : ?> Continua a leggere


leggi tutte le altre news

Alberto Santini


!!!!!!!! It's right ..... The custom field id is "1" ... but probably the array is 0 ...
So I've changed it and now is done!


$item->jcfields = FieldsHelper::getFields('com_content.article', $item, true);
                    echo FieldsHelper::render('com_content.article', 'field.render', array('field'=> $item->jcfields[0]));


Thank you so much!!

Lefteris Kavadas
You are welcome! Please post a review if you like our extension!

Regards

Vacation Notice: We’re currently in vacation mode. Response times may be longer than usual, but we’ll get back to you as soon as possible. Thanks for your patience!

Note: An active subscription is required in order to get support for our paid extensions. For our free extensions, if you don't have an account, register and then submit your support request.  In case you just want to ask a question, you can also use the contact form .

Firecoders
Are you using our extensions? Please post a review at the Joomla extensions directory!
Post a review