Back again. Thanks to the advice here, I updated the database definition with several fields. I can happily update these fields in tl_member directly via the database. Now I'm trying to expose these fields in the back end so that I can update them a whole lot easier.
I created a file called \system\modules\z_bcrfc_modifications\config\datab ase.sql and populated it it with
Code:
CREATE TABLE `tl_member`(
`bcrfc_2010_payment_status` varchar(8) NOT NULL default '',
`bcrfc_2010_payment_amount` varchar(8) NOT NULL default '',
`bcrfc_2010_payment_date` varchar(11) NOT NULL default '',
`bcrfc_2010_jersey` varchar(3) NOT NULL default '',
`bcrfc_2010_shorts` varchar(3) NOT NULL default '',
`bcrfc_2010_socks` varchar(3) NOT NULL default '',
`bcrfc_school` varchar(48) NOT NULL default '',
`bcrfc_mother_name` varchar(24) NOT NULL default '',
`bcrfc_mother_number` varchar(24) NOT NULL default '',
`bcrfc_father_name` varchar(24) NOT NULL default '',
`bcrfc_father_number` varchar(24) NOT NULL default '',
`bcrfc_medical_notes` varchar(256) NOT NULL default '',
`bcrfc_player_name` varchar(24) NOT NULL default '',
`bcrfc_other_family` varchar(96) NOT NULL default '',
`bcrfc_2010_team` varchar(5) NOT NULL default '',
`bcrfc_2010_cash_cheque` varchar(5) NOT NULL default '',
`bcrfc_retired` varchar(96) NOT NULL default '',
`bcrfc_2010_form_complete` varchar(5) NOT NULL default '',
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
I ran the install tool and all the fields were added to tl_member. I have been populating them via the database directly for months now and at this stage I want to start populating them via the Contao backend.
Following the guidelines here - http://www.contao.org/adding-custom-fie ... l#new-name - I created a file called \system\modules\z_bcrfc_modifications\dca\tl_membe r.php and populated it with
Code:
// Modify the palette
$GLOBALS['TL_DCA']['tl_member']['palettes']['default'] = str_replace
(
'company',
'bcrfc_2010_team,company',
$GLOBALS['TL_DCA']['tl_member']['palettes']['default']
);
// Add the field meta data
$GLOBALS['TL_DCA']['tl_member']['fields']['bcrfc_2010_team'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_member']['bcrfc_2010_team'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('rgxp'=>'alnum', 'maxlength'>=5)
);
I changed the 'rgxp' eval element from the example on the page to recognise that the field is alphanumeric, and also removed the 'mandatory' element and changed the maxlength. Unfortunately when I try to view the members page on the backend I get
// Modify the palette $GLOBALS['TL_DCA']['tl_member']['palettes']['default'] = str_replace ( 'company', 'bcrfc_2010_team,company', $GLOBALS['TL_DCA']['tl_member']['palettes']['default'] ); // Add the field meta data $GLOBALS['TL_DCA']['tl_member']['fields']['bcrfc_2010_team'] = array ( 'label' => &$GLOBALS['TL_LANG']['tl_member']['bcrfc_2010_team'], 'exclude' => true, 'inputType' => 'text', 'eval' => array('rgxp'=>'alnum', 'maxlength'>=5) );
Warning: Cannot modify header information - headers already sent by (output started at /home/blackroc/public_html/system/modules/z_bcrfc_modifications/dca/tl_member.php:15) in /home/blackroc/public_html/system/libraries/Template.php on line 174
#0 /home/blackroc/public_html/system/libraries/Template.php(174): __error(2, 'Cannot modify h...', '/home/blackroc/...', 174, Array)
#1 /home/blackroc/public_html/system/modules/backend/BackendTemplate.php(135): Template->output('Content-Type: t...')
#2 /home/blackroc/public_html/typolight/main.php(286): BackendTemplate->output()
#3 /home/blackroc/public_html/typolight/main.php(102): Main->output()
#4 /home/blackroc/public_html/typolight/main.php(295): Main->run()
#5 {main}
Can anyone point me in the right direction and give me a hint as to what I'm doing wrong please ?
Thanks,
z
p.s. I've edited this a few times as I tested out various tweaks, but the above is my current config.
Bookmarks