Fieldtype

Archived
Forum
(read-only)

The Selectatron

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From iain

     

PHP Errors when creating new custom field

Bug Report

Carlo
Carlo

I get some PHP errors whenever I’m trying to create a custom field. That’s regardless whether I select it to be a Selectatron type field. It just appears in the ‘Create New Custom Field’ page.

Here are the errors I get:

A PHP Error was encountered
Severity
Notice
Message
Undefined variablechannel_options
Filename
the_selectatron/ft.the_selectatron.php
Line Number
267

A PHP Error was encountered
Severity
Warning
Message
Invalid argument supplied for foreach()
Filenamehelpers/form_helper.php
Line Number
324

A PHP Error was encountered
Severity
Warning
Message
Cannot modify header information headers already sent by (output started at /PATH_TO_SYSTEM/codeigniter/system/core/Exceptions.php:171)
Filenamecore/Common.php
Line Number
424 


I’m using EE2.1.0, Build 20100805

iain
# 1
Developer
iain

Can you confirm that you have actually created a channel in your install?

The error above would indicate you don’t have any channels yet.

Fred Carlsen
# 2
Fred Carlsen

I’m getting the same, and you are right. I have no channels.

Something in the way of:

if ($channels_query->num_rows() > 0)
   
{
    
// loop through the channels
    
foreach ($channels_query->result_array() as $channel)
    
{
     $channel_id 
$channel['channel_id'];
     
$channel_title $channel['channel_title'];
     
$channel_options[$channel_id] $channel_title;
    
}

   } 
and later on
if (isset($channels_options))
   
{
    
// add the table row for selecting channels, and the multiselect
    // @todo let users build a list of manual options, not just entries
    
$this->EE->table->add_row(
     
$this->EE->lang->line('select_channels'),
     
form_multiselect('channel_preferences[]'$channel_options$selected_channels)
    );
   
else {
    $this
->EE->table->add_row(
     
$this->EE->lang->line('select_channels'),
     
'You have not added any channels.'
    
); 
   

Merry christmas, Iain! Even if you don’t have snow.