I need help with my code. The if statement will check session for user privilege. If it's admin it will show the active() array and if not the active() will not be shown. Is there anyway I could optimize this code? I don't want to coded the same code twice just to deactivate the active() array?
if($_SESSION["s"]["user"]["typ"] == 'admin') { $form["tabs"]['dns_soa'] = array ( 'title' => "DNS Zone", 'width' => 100, 'template' => "templates/dns_soa_edit.htm", 'fields' => array ( ################################## # Begin Datatable fields ################################## 'update_acl' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', 'default' => '', 'value' => '', 'width' => '30', 'maxlength' => '255' ), 'active' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'CHECKBOX', 'default' => 'Y', 'value' => array(0 => 'N',1 => 'Y') ), ################################## # ENDE Datatable fields ################################## ) ); } else { $form["tabs"]['dns_soa'] = array ( 'title' => "DNS Zone", 'width' => 100, 'template' => "templates/dns_soa_edit.htm", 'fields' => array ( ################################## # Begin Datatable fields ################################## 'update_acl' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'TEXT', 'default' => '', 'value' => '', 'width' => '30', 'maxlength' => '255' ), ################################## # ENDE Datatable fields ################################## ) ); } Thanks in advance.