geting fields values of a related item

More
10 years 1 week ago #61248 by ydl
Hi,

I have two item typs: course and course_type
I create a related item in course which is poining to an item of a course_type type.
I am trying to get the value of fields stored in a (specific) item of the course_type in my custom code.
How I am doing it?
Thanks, Yair

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

More
10 years 1 week ago #61256 by micker
juste use {{fieldname}}

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

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

More
10 years 1 week ago #61257 by ydl
Thanks...
I am sorry but I don't understand.
I have in my code the following:
$courseType = $item->_row->fields;

now I want to get the '$courseTypeItem' from the related (reference) field and I don't understand how I am doing it....
Unless... I have to define the relation field for each field I want to get?

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

More
10 years 1 week ago #61311 by ydl
OK - I understand how to construct the "display" of a related field.
My issue is that with this solution I cannot sperate the diffrent fields of the related items...
I can think on a solution that the display will be stored in a JSON structure and will be convert to PHP variables in the template code.
Any other idea?

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

More
10 years 1 week ago #61391 by ggppdk
Hello

JSON output exists for category view only,
it allows retrieving all the allowed (by ACCESS Level) fields for current user

&format=json


-- 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 review. Thanks!

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

More
10 years 1 week ago #61392 by ggppdk
Hello

also see out FAQ for loading an item in custom code

www.flexicontent.org/documentation/faq/7...-in-custom-code.html

So
1. you can load an item in custom code
2. examine the value of the item for the relation field and find the IDs
3. then get all related items


-- 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 review. Thanks!

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

More
10 years 1 week ago #61395 by ydl
Maybe I didn't explain myself correctly.
What I did, and it works, is:
In the field definition, under the HTML attribute I put the following:
{"text":"{{text}}", "subtitle":"{{sub_title}}", "short":"{{short_desc}}"}
and it works. I have to do somting in my retrieving code before decode it to JSON with the newline BUT that manipulation is easy.

For the item data retrieving - I saw the FAQ you mention BUT could not understand from a print_r($item) of the specific item what its original ID

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

Moderators: vistamediajoomlacornerggppdk
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