This is the example taken from the docs on plugin creation. What i want is to have a cron job to gather some information and create an entry.
$this->EE->load->library('api');
$this->EE->api->instantiate('channel_entries');
$this->EE->api->instantiate('channel_fields');
$data = array(
'title' => 'Breaking News Story!',
'entry_date' => '1256953732',
'field_id_6' => 'Some data',
'field_ft_6' => 'none',
'field_id_19' => 'More data',
'field_ft_19' => 'xhtml'
);
$this->EE->api_channel_fields->setup_entry_settings($channel_id, $data);
if ($this->EE->api_channel_entries->submit_new_entry($channel_id, $data) === FALSE)
{
show_error('An Error Occurred Creating the Entry');
}Questions are
How do I know these ids
'field_id_6' => 'Some data',
'field_ft_6' => 'none',
'field_id_19' => 'More data',
'field_ft_19' => 'xhtml'How do i know the channel_id? Is there a way to get the id of a channel by name or do i need to memorize the id of each channel i have?
Cheers