#158 – render plugin in article module

Status: Closed - Category: Econa
 Hi I need to render the image also in tne mod_articles_category
Hw can I do?
Hi,

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

Regards
 
I'm using Custom field

I'm trying with mod_articles_latest and mod_articles_category ...
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
 

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

defined('_JEXEC') or die;
?>
		<?php foreach ($list as $item) : ?>
				<?php if ($params->get('link_titles') == 1) : ?>
					<h4><a class="mod-articles-category-title <?php echo $item->active; ?>" href="/<?php echo $item->link; ?>"><?php echo $item->title; ?></a></h4>
				<?php else : ?>
					<h4><?php echo $item->title; ?></h4>
				<?php endif; ?>

                <img class="image_intro" src="/<?php echo $image->src; ?>" alt="<?php echo $images->image_intro_alt; ?>" style="width: 100%" /> 

				<?php if ($item->displayDate) : ?>
					<span class="mod-articles-category-date">
						<?php echo $item->displayDate; ?>
					</span>
				<?php endif; ?>

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

				<?php if ($params->get('show_introtext')) : ?>
					<p class="mod-articles-category-introtext">
						<?php echo $item->displayIntrotext; ?>
					</p>
				<?php endif; ?>

					<p class="uk-text-center uk-margin-small">
						<a class="uk-button uk-button-text <?php echo $item->active; ?>" href="/<?php echo $item->link; ?>">
							<?php if ($item->params->get('access-view') == false) : ?>
							<?php elseif ($params->get('show_readmore_title', 0) == 0) : ?>
								Continua a leggere
							<?php endif; ?>
						</a>
					</p>
         <hr class="uk-divider-icon">
    	<?php endforeach; ?>
            <a class="uk-button uk-button-text <?php echo $item->active; ?>" href="/component/content/category/?layout=blog&Itemid=117">leggi tutte le altre news</a>


!!!!!!!! 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!!
You are welcome! Please post a review if you like our extension!

Regards
 
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.

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 .

Note: Our support team is currently on vacation, so please anticipate slightly longer response times. Thank you for your understanding!

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