Minifrontpagepro Layout Override and add fields
- Posted by dejanbojovic (8) Offline
I tried to add fields to the newsy.php file, but without success.
example 1
<?php
if (isset($fields->value) && !empty($fields->value)) : ?>
<?php echo $fields->label; ?>
<?php echo $fields->value; ?>
<?php endif; ?>
example 2
<?php echo $fields->value; ?>
example 3
<?php echo $fields->value; ?>
2 years 2 weeks ago #1
by dejanbojovic
example 1
<?php
if (isset($fields->value) && !empty($fields->value)) : ?>
<?php echo $fields->label; ?>
<?php echo $fields->value; ?>
<?php endif; ?>
example 2
<?php echo $fields->value; ?>
example 3
<?php echo $fields->value; ?>
The topic has been marked as resolved.
- Posted by TemplatePlazza (5260) Offline
Hi, Can you tell me in more detail about what result you are trying to get?
2 years 2 weeks ago #2
by TemplatePlazza
The topic has been marked as resolved.
- Posted by dejanbojovic (8) Offline
I need to place the extra field in certain places. I used minifrontpagepro for k2 and joomla 3 using this code:
Now I would like to do the same in joomla 4
using this code for Minitek slider:
but it doesn't work in minifrontpagepro.
2 years 2 weeks ago #3
by dejanbojovic
<?php if(isset($item->extraFields->cena->value) === true && empty($item->extraFields->cena->value) === false): ?>
<!-- here you can add the code you like to be shown -->
<div class="cena-default"><p><?php echo $item->extraFields->cena->value;?>€</p></div>
<!-- End Code -->
<?php endif; ?>
Now I would like to do the same in joomla 4
using this code for Minitek slider:
<?php $item->jcfields = Joomla\Component\Fields\Administrator\Helper\FieldsHelper::getFields('com_content.article', $item, true);
$fields = [];
foreach ($item->jcfields as $jcfield)
{
$fields[$jcfield->name] = $jcfield;
}
?>
<div class="kategorija-objekta-cat"><?php echo $fields['kategorija']->value; ?></div>
but it doesn't work in minifrontpagepro.
The topic has been marked as resolved.
- Posted by TemplatePlazza (5260) Offline
Hi, both the codes you mentioned are different. One for K2 and one for Joomla com_content. Can you explain it in more detail?
Also, are you trying to run K2 in Joomla 4?
2 years 2 weeks ago #4
by TemplatePlazza
Also, are you trying to run K2 in Joomla 4?
The topic has been marked as resolved.
- Posted by dejanbojovic (8) Offline
I just gave you an example of how it worked with k2.
I don't use k2 anymore because it doesn't support joomla 4.
Now I use joomla 4 content.
I simply need code to display a specific field. As shown in the attached image.
2 years 2 weeks ago #5
by dejanbojovic
I don't use k2 anymore because it doesn't support joomla 4.
Now I use joomla 4 content.
I simply need code to display a specific field. As shown in the attached image.
The topic has been marked as resolved.
- Posted by TemplatePlazza (5260) Offline
You can do something like this :
2 years 2 weeks ago - 2 years 2 weeks ago #6
by TemplatePlazza
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
$item->jcfields = FieldsHelper::getFields('com_content.article', $item, true);
foreach((array)$item->jcfields as $jcfield) {
echo $jcfield->label;
echo $jcfield->value;
}
Last edit: 2 years 2 weeks ago by TemplatePlazza.
The topic has been marked as resolved.