populating a dropdown with JEvent entries

typomaniac 2d ago

Dear all,

in CF 7, I use the below script to populate a dropdown with specific entries from JEvents. This works smooth and fine for years now on this site: https://pdh.ch/index.php/de/agenda

Now I installed CF8 on a J5 site and tried to use the same logic. But the db entries are not showing up:

$current_day = JFactory::getDate('+0 seconds');$current_day = $current_day->toUnix();$options = array();$db =& JFactory::getDBO();$query = "SELECT    #__jevents_vevdetail.dtstart,     #__jevents_vevdetail.summaryFROM #__jevents_vevdetailINNER JOIN #__jevents_vevent ON #__jevents_vevdetail.evdet_id = #__jevents_vevent.detail_idWHERE    #__jevents_vevdetail.dtstart > " . $current_day ." AND    #__jevents_vevent.access = 1 AND    #__jevents_vevent.state >= 1order by #__jevents_vevdetail.dtstart;";$db->setQuery($query);return $db->loadAssocList();foreach ( $data as $d ) {  $options[] = "<option value='{$d->summary}'>{$d->summary}</option>";}

Where do I have to adapt this part in order to fetch the data?Thanks so much for your help,

Martin

typomaniac 2d ago
Answer
1 Likes

ISSUE SOLVED. I have to use the new Read Data function, which makes it way easier.

Max_admin 1d ago

Great, thanks for sharing your solution! :)

You can use the Read Data with the "Where Statement" to choose which records to read, and feed that to the Dynamic Options of the Dropdown

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
You need to login to be able to post a reply.