[Corrected FAQ] Retrieving item data e.g. for use in RSforms

More
13 years 8 months ago #24956 by arnaud.blain
IT WORKS !!!

thank you so it was just a f...ing space that was needed before WHERE

I put the code in order you change it in the faq

//<code>
$db = & JFactory::getDBO();
// Set a different item id if you don't want the current item ...
$fcitem_id= JRequest::getInt('id',0);
$fccat_id= JRequest::getInt('cid',0);
$view= JRequest::getVar('view');
if ($view!='items' && $view!='item' && $view!='article') {
return "not in items view";
}

$field_id=19; // CHANGE THIS TO THE ID OF YOUR FIELD
if ($fcitem_id) {
$query = 'SELECT c.title, c.alias, f.value '
.'FROM '.'#'.'__content AS c '
.' LEFT JOIN '.'#'.'__flexicontent_fields_item_relations AS f'
.' ON f.item_id = c.id AND f.field_id='.(int)$field_id
.' WHERE c.id = ' . $fcitem_id;

$db->setQuery($query);
$itemdata = $db->loadObject();
$item_title = $itemdata->title;
}
return $itemdata->value;
//</code>

thanks

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

More
13 years 8 months ago #24994 by ggppdk
Fixed the FAQ article to have spaces so that DB query does not fail

Regards


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

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