Field type as class on flexicontent templates

More
11 years 1 week ago #42061 by jrodgar
Hi!

When showing the fields on the item/category template, is there a way to add the field type as class? (instead/adding to the field name)

Here for example
Code:
<?php foreach ($item->positions['top_col2'] as $field) : ?> <div class="flexi element"> <?php if ($field->label) : ?> <span class="flexi label field_<?php echo $field->name; ?>"><?php echo $field->label; ?></span>


I peeked the $field item and it looks like it doesn´t have a type attribute to use

Unless otherwise indicated:
Joomla 3.8.1
Flexicontent 3.2.1.7

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

More
11 years 1 week ago #42136 by ggppdk
Hello

you can use something like:
<?php echo 'fieldtype_'.$field->field_type; ?>


-- 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...

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

More
11 years 1 week ago #42195 by jrodgar
I think not, this is what print_r returns

stdClass Object ( [id] => 16 [name] => imagefield16 [label] => Image [display] => /*omited*/ )


Name could work in case of core fields.

Unless otherwise indicated:
Joomla 3.8.1
Flexicontent 3.2.1.7

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

More
11 years 1 week ago #42280 by ggppdk
Hello

yes,

the full item information is available elsewhere so try to use this :

<?php echo 'fieldtype_'.$item->fields[$field->name]->field_type; ?>


-- 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...

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

More
10 years 11 months ago #43047 by jrodgar
This worked perfectly, thanks ;)

Unless otherwise indicated:
Joomla 3.8.1
Flexicontent 3.2.1.7

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 1.089 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