About rendering display HTML of fields when using custom Layout in Universal module

More
7 years 10 months ago - 7 years 10 months ago #62249 by iamrobert
Hi,

Sorry - poorly constructed plugin template. :dry:

[strike]I'm trying to render fields in mod_flexicontent. If I use news template - it renders ok.

However - all I want is the field.

So - if you take the default.php mod_flexicontent template and add the if use_fields - nothing renders:
Code:
<?php if ($use_fields_feat && @$item->fields && $fields_feat) : ?> <div class="fc_block fcitem_fields"> <?php foreach ($item->fields as $k => $field) : ?> <?php if ( $hide_label_onempty_feat && !strlen($field->display) ) continue; ?> <div class="field_block field_<?php echo $k; ?>"> <?php if ($display_label_feat) : ?> <div class="field_label"><?php echo $field->label . $text_after_label_feat; ?></div> <?php endif; ?> <div class="field_value"><?php echo $field->display; ?></div> </div> <?php endforeach; ?> <?php endif; ?>

Have tried copying the xml file and the php values - but it doesn't seem to work. Any ideas?

I think I'll revert to:
Code:
<?php if (isset($item->_row->fieldvalues[15][0]) && ($item->_row->fieldvalues[15][0] != null)): ?> <?php echo $item->_row->fieldvalues[15][0]; ?> <?php endif; ?>

I am using:
FLEXIcontent 3.1.0-dev

Cheers,

Robert[/strike]
Last edit: 7 years 10 months ago by ggppdk.

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

More
7 years 10 months ago - 7 years 10 months ago #62254 by ggppdk
Hello

for the fields HTML to be created you need to select the custom fields in "Select Fields" TAB
- which i guess you did

now if you don't need to create the HTML surely using:
Code:
$item->_row->fieldvalues
is faster

To manually create the HTML of field for an item use:
Code:
$field_html = FlexicontentFields::getFieldDisplay($item->_row, 'fieldname'); echo $field_html;
Read more here:
How to manually render/display fields inside templates ... and Upgrading custom Templates to work in v1.5.6+

[EDIT]
i have recently commit a fix, to allow loading custom XML file from Joomla template folder, besides loading the PHP file, which was already done,
also made some corrections here:
How to create a custom layout for Universal content module and other FLEXIcontent modules


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 7 years 10 months ago by ggppdk.

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

More
7 years 10 months ago - 7 years 10 months ago #62271 by iamrobert
Thanks for the updated help!

I think the issue is - perhaps it requires the title of the article for the module to work:
Code:
$item->title;

as soon as I remove this the module disappears. I'll wrap it in invisible.
Code:
<?php // no direct access defined('_JEXEC') or die('Restricted access'); ?> <?php if (isset($list[$ord]['featured'])) : ?> <!-- BOF featured items --> <?php foreach ($list[$ord]['featured'] as $item) : ?> <?php if ($use_fields_feat && @$item->fields && $fields_feat) : ?> <?php foreach ($item->fields as $k => $field) : ?> <?php if ( $hide_label_onempty_feat && !strlen($field->display) ) continue; ?> <?php echo $field->display; ?> <?php endforeach; ?> <?php endif; ?> <div class="invisible"><?php echo $item->title; ?></div> <!-- EOF current item --> <?php endforeach; ?> <!-- EOF featured items --> <?php endif; ?>
Last edit: 7 years 10 months ago by iamrobert.

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.288 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline