Forums

Populate eventlist title

luisbarros 05 Mar, 2010
Hi,
How can I populate a form field with an Eventlist event title?
I'm using chronocontact plugin to display the form inside the events description.
So, the idea would be to get the event title(also date and time would be wonderfull!) displayed in the form and sent through email.
Greetings,
🙄
GreyHead 05 Mar, 2010
Hi luisbarros,

You'd need to look up the event details in the EventsList tables - but I don't know what you need to look up or how you get the event_id.

Bob
luisbarros 05 Mar, 2010
Dear Bob,
Thank you very much for your reply.
I have no knowledge of php/mysql coding, so I exported the events table from eventlist. Can you help me?
Here it goes:

Table structure for table `jos_eventlist_events`
--

CREATE TABLE IF NOT EXISTS `jos_eventlist_events` (
`id` int(11) unsigned NOT NULL auto_increment,
`locid` int(11) unsigned NOT NULL default '0',
`catsid` int(11) unsigned NOT NULL default '0',
`dates` date NOT NULL default '0000-00-00',
`enddates` date default NULL,
`times` time default NULL,
`endtimes` time default NULL,
`title` varchar(100) NOT NULL default '',
`alias` varchar(100) NOT NULL default '',
`created_by` int(11) unsigned NOT NULL default '0',
`modified` datetime NOT NULL,
`modified_by` int(11) unsigned NOT NULL default '0',
`author_ip` varchar(15) NOT NULL default '',
`created` datetime NOT NULL,
`datdescription` mediumtext NOT NULL,
`meta_keywords` varchar(200) NOT NULL default '',
`meta_description` varchar(255) NOT NULL default '',
`recurrence_number` int(2) NOT NULL default '0',
`recurrence_type` int(2) NOT NULL default '0',
`recurrence_counter` date NOT NULL default '0000-00-00',
`datimage` varchar(100) NOT NULL default '',
`checked_out` int(11) NOT NULL default '0',
`checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
`registra` tinyint(1) NOT NULL default '0',
`unregistra` tinyint(1) NOT NULL default '0',
`published` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=15 ;

--
-- Dumping data for table `jos_eventlist_events`
--

INSERT INTO `jos_eventlist_events` (`id`, `locid`, `catsid`, `dates`, `enddates`, `times`, `endtimes`, `title`, `alias`, `created_by`, `modified`, `modified_by`, `author_ip`, `created`, `datdescription`, `meta_keywords`, `meta_description`, `recurrence_number`, `recurrence_type`, `recurrence_counter`, `datimage`, `checked_out`, `checked_out_time`, `registra`, `unregistra`, `published`) VALUES
(1, 1, 1, '2010-03-18', NULL, '21:00:00', NULL,
GreyHead 06 Mar, 2010
Hi luisbarros,

OK, from this you can use this code to get the info
<?php
if ( !$mainframe->isSite(0 ) { return; }
$db =& JFactory::getDBO();
$query = "
  SELECT `title`, `dates`, `times`
    FROM `#__eventlist_events`
    WHERE `id` = ???? ;
";
$db->setQuery($query);
$event = $db->loadObject();
?>

But you still need to find the event id to replace the ???? This may be availalbe from the page url?

Bob
luisbarros 08 Mar, 2010
Thank you very much for your help.😀
What's the best way to use the script?
Put it on a field or using the profile plugin?
Greetings,
Luis
GreyHead 08 Mar, 2010
Hi Luisbarron,

This goes at the beginning of the Form HTML - but caution - it's not complete. You need to add more code to link it to your form.

Bob
luisbarros 08 Mar, 2010
Do you mean the event ID, right? ...or ... is there anything else?
Thanx
GreyHead 08 Mar, 2010
Hi luisbarros,

That, and doing something with the results.

Bob
luisbarros 08 Mar, 2010
Like put them in a text box?🙄
This topic is locked and no more replies can be posted.