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

More
12 years 1 week ago #24544 by arnaud.blain
Hello,

I was using RS form in a flexicontent item and works fine until now.

I don't know if it's the fact I upgrade to FLEXIcontent version 1.5.6 RC4 (r1235) but now it doesn't give me the data I'm waited (mail and title)

I check this FAQ : www.flexicontent.org/documentati ... forms.html

also check if RS form plugin are enabled, all my flexicontent plugin are enabled too , I tried to use Sourcerer too but it doesn't work.

Instead having the data, i just have the code entered in default value RS Form field :

$db = & JFactory::getDBO(); $fcitem_id= JRequest::getInt('id',0); $view= JRequest::getVar('view'); if ($view!='items' && $view!='item' && $view!='article') { return "not in items view"; } // RETRIEVE item data if ($fcitem_id) { $query = 'SELECT c.* ' .'FROM '.'#'.'__content AS c ' .'WHERE c.id = ' . $fcitem_id; $db->setQuery($query); $itemdata = $db->loadObject(); $item_title = $itemdata->title; } // e.g. return $item_title;

thanks

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

More
12 years 1 week ago #24545 by ggppdk
I am not using the RSform but does it not have a option to specify that the value entered is PHP CODE that must be executed?

Trying checking out RSform FAQ


-- 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
12 years 1 week ago #24570 by arnaud.blain
in fact I had to add //<code> at the begining and //</code> at the end in the Default value of my hidden RS form pro.

So it works for title (basic field) but when I try to use a custom field (well, if email field is a custom field) i've got this error : Parse error: syntax error, unexpected '.' in /administrator/components/com_rsform/helpers/rsform.php(449) : eval()'d code on line 17

my code is exactly the same (with //<code> and //</code> this time) like FAQ : Retrieving the value of a custom field :

//<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 = i.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>

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

More
12 years 1 week ago #24572 by ggppdk
There is a redundant comma, i removed it from the FAQ article.

Change line:
.' ON f.item_id = i.id AND f.field_id='.(int)$field_id;
and remove the ending comma:
.' ON f.item_id = i.id AND f.field_id='.(int)$field_id

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

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

More
12 years 1 week ago #24614 by arnaud.blain
Hello ggpdk,

thank you I didn't see that but it didn't work.
The error disappear but I don't get the data field.

There's something strange in the FAQ (title field name is used):

at the end it's written :

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


So I tried with my field name id:19 with is called courriel but it's the same, the return result is empty:

$db->setQuery($query);
$itemdata = $db->loadObject();
$item_email = $itemdata->courriel;
}
return $item_email;
//</code>


thanks

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

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