I need to compose a list for a RSFormPro form field which contains options that display article titles and their respective date from a custom field.
In front something like this :
Select your courses : Title of the article - 25/12/2019 (date from the custom field)
I see this article, but I don't know how combine it with the custom field www.rsjoomla.com/support/documentation/r...st-from-a-table.html
With the following code, I am able to retrieve article title from specific categories
// Prepare the empty array
$items = array();
// Prepare the database connection
$db = JFactory::getDbo();
// Keep this if you'd like a "Please select" option, otherwise comment or
remove it
$items[] = "|Please Select[c]";
// Run the SQL query and store it in $results
$db->setQuery("SELECT title, title FROM jos0x_content WHERE catid = 13 or
catid = 14");
$results = $db->loadObjectList();
// Now, we need to convert the results into a readable RSForm! Pro format.
// The Items field will accept values in this format:
// value-to-be-stored|value-to-be-shown
// Eg. m|M-sized T-shirt
foreach ($results as $result) {
$value = $result->title;
$label = $result->title;
$items[] = $value.'|'.$label;
}
// Multiple values are separated by new lines, so we need to do this now
$items = implode("\n", $items);
// Now we need to return the value to the field
return $items;
In database :
Table jos0x_content : title Table jos0x_fields_values : field_id=2(calendar field), value, and in item_id the related id of the article