Logo of SermonSpeaker Extension Claim

Login Form

Joomla Fields - display in Sermon Speaker

More
1 year 4 months ago #6680 by Thomas Hunziker
The automatic display events use the JLayout located in components/com_fields/layouts/fields/render.php. You can override that in your template globally or even make an override for com_sermonspeaker.
But I think you're not getting lucky with that either. You need to get a bit more creative for table layouts.
In the table header section, you can add this code at the place you like:
<?php if ($this->items[0]->jcfields) : ?>
	<?php foreach ($this->items[0]->jcfields as $field) : ?>
		<th><?php echo JText::_($field->title); ?></th>
	<?php endforeach; ?>
<?php endif; ?>
And in the data section you put this:
<?php if ($item->jcfields) : ?>
	<?php foreach ($item->jcfields as $field) : ?>
		<td><?php echo $field->value; ?></td>
	<?php endforeach; ?>
<?php endif; ?>

That should show all custom fields for an item at the place where you add the code.
If you only want to show selected you would have to hardcode it in your layout. Eg $item->jcfields[4] would be the field with the ID 4.

Feel free to rate SermonSpeaker on JED .
Useful documentation for beginners: First Steps & FAQ
How to say "Thank You!": Contribute or support using the Donate button at the bottom of each page.

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago - 1 year 4 months ago #6681 by Alan Wright
Thanks again. The code you listed worked well - I was on a similar track, but couldn't figure out the syntax of jcfields.

I tried making the column sortable like the others, but couldn't get it to work. Probably something to do with the fields being in a different table to the sermons? Not a big deal - just thought I'd try.

<th class="ss-col ss-service hidden-
<?php if (!$limit) :
echo JHtml::_('grid.sort', $field->title, $field->value, $listDirn, $listOrder);
else :
echo JText::_($field->title);
endif; ?>
</th>
Last edit: 1 year 4 months ago by Alan Wright.

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #6682 by Thomas Hunziker
You can't sort by the fields due to the way the whole custom field feature works.

Feel free to rate SermonSpeaker on JED .
Useful documentation for beginners: First Steps & FAQ
How to say "Thank You!": Contribute or support using the Donate button at the bottom of each page.

Please Log in or Create an account to join the conversation.

Time to create page: 0.108 seconds
Powered by Kunena Forum