- Posts: 29
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- Finding value of custom field by custom_field_id and item_id
Finding value of custom field by custom_field_id and item_id
- Usop Wilcha
- Topic Author
- Offline
- Junior Member
Less
More
7 years 4 months ago #163026
by Usop Wilcha
Finding value of custom field by custom_field_id and item_id was created by Usop Wilcha
Hi K2 experts,
To search and get title of K2 item, I'm halfway until here
How can I find the value of custom field by custom_field_id and item_id ?
Thanks
To search and get title of K2 item, I'm halfway until here
if ($option=="com_k2" && $view=="item") {
$item_id = $jinput->getInt('id');
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_k2/tables');
$item = JTable::getInstance('K2Item', 'Table', array());
$item->load($item_id);
$title = $item->title;
}
Thanks
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 4 months ago #163035
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Finding value of custom field by custom_field_id and item_id
Hello there Danny,
I will need some context. Where do you want this data shown?
Custom view, template, admin view?
I will need some context. Where do you want this data shown?
Custom view, template, admin view?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Usop Wilcha
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 29
7 years 4 months ago #163067
by Usop Wilcha
Replied by Usop Wilcha on topic Finding value of custom field by custom_field_id and item_id
This code is called at front-end model.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 4 months ago #163082
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Finding value of custom field by custom_field_id and item_id
Front-end model of K2, a custom extension?
If it is the same item then you don't need any of this code, you can find the value based on the field's alias.
If it is the same item then you don't need any of this code, you can find the value based on the field's alias.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Usop Wilcha
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 29
7 years 4 months ago #163096
by Usop Wilcha
Replied by Usop Wilcha on topic Finding value of custom field by custom_field_id and item_id
Not really
I'm building a directory type website
I'm embedding external form module in the K2 field, so that every items has their own form
This sample link is not built with K2, but it has the same objective that i need
Tour code form field will be the value from the custom fields, now, the problem is how to pick up the value into our form fields,
Hope i made myself a clear explanation here :)
I'm building a directory type website
I'm embedding external form module in the K2 field, so that every items has their own form
This sample link is not built with K2, but it has the same objective that i need
Tour code form field will be the value from the custom fields, now, the problem is how to pick up the value into our form fields,
Hope i made myself a clear explanation here :)
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 4 months ago #163101
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Finding value of custom field by custom_field_id and item_id
Still you don't need this code. It's a bit of an overkill. You can do this within the item.php file (less queries)
You can print the value of a specific field like this
github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php#L168-L173
You can print the value of a specific field like this
github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php#L168-L173
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Usop Wilcha
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 29
7 years 3 months ago #163204
by Usop Wilcha
Replied by Usop Wilcha on topic Finding value of custom field by custom_field_id and item_id
Thanks man, you're the best! :)
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 3 months ago #163210
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Finding value of custom field by custom_field_id and item_id
Thanks Danny :)
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- Finding value of custom field by custom_field_id and item_id