[SOLVED] How to display 1 field in several positions?

More
9 years 2 months ago - 9 years 2 months ago #61600 by lipatovroman
Hi!
I have checkbox field with labels and images.





How to display this field in 2 positions?

And how to display in 1-st position images, but in 2-nd position - labels?

Last edit: 9 years 2 months ago by ggppdk.

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

More
9 years 2 months ago - 9 years 2 months ago #61604 by ggppdk
Hello

it is possible, but for the UI drag and drop placement we have not allowed it
- that is because
some fields include HTML tag ID , thus the proper is to add them only once,
e.g. image field, the gallery JS might have issue if you display the field multiple times


For checkbox(image), radio(image) , etc fields, you will not have such an issue
- do like this:
1. add field into render only position
2. Inside the PHP code:
item(_hml5).php
category_items(_hml5).php

add in multiple places a line like this:
echo $item->fields->display;

e.g. you can add it before or after the "foreach" loop of a layout position
- be careful not to break PHP syntax (you can select all file text and backup it and then if you see PHP syntax error then undo the change and re-add code more carefully)

[EDIT]
I have used this answer to add a new FAQ article in our FAQ section:
www.flexicontent.org/documentation/faq.html


-- 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: 9 years 2 months ago by ggppdk.

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

More
9 years 2 months ago #61620 by lipatovroman
Hi!

I added checkboximage field in usual mode and it displays fine.



Now I need to display values from this filed (not images) in another place.



I have added this code in template
Code:
<?php echo $item->fields["opeartingsystem"]->display; ?>

But it displays images again. I need it displays only text values.

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

More
9 years 2 months ago - 9 years 2 months ago #61621 by ggppdk
See this small FAQ article on how to get the values:

Using the raw value of a field inside a template file or inside a new custom field type

then if you also want to get the full details of a value e.g. 1
Code:
$field = $item->fields['myfieldname']; $elements = FlexicontentFields::indexedField_getElements($field, $item, self::$extra_props); $v =1; $element = $elements[$v]; print_r($element); $v =2; $element = $elements[$v]; print_r($element);


-- 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: 9 years 2 months ago by ggppdk.

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

More
9 years 2 months ago #61623 by lipatovroman
I added your code in my template:
Code:
<?php echo $item->fields["opeartingsystem"]->display; $field = $item->fields['opeartingsystem']; $elements = FlexicontentFields::indexedField_getElements($field, $item, self::$extra_props); $v =1; $element = $elements[$v]; print_r($element); $v =2; $element = $elements[$v]; print_r($element); ?>

and now page displays so:

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

More
9 years 2 months ago #61625 by ggppdk
Hello

it is just code to test code, you should test it and see what is available


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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.638 seconds
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
Save