function crear($first, $second, $third, $fourth, $fifth, $sixth){
$sixth= ($sixth > 0 ? "<span class='required'>*</span>" : "");
if($fourth=='input'){
echo "\t <div class='field-box ".$third."' id='".$first."_field_box'> \n";
echo "\t\t <div class='display-as-box' id='".$first."_display_as_box'>".$second." ".$sixth.":</div> \n";
echo "\t\t <div class='input-box' id='".$first."_input_box'> \n";
echo "\t\t <input id='field-".$first."' name='".$first."' type='text' maxlength='".$fifth."' /> </div><div class='clear'></div> \n";
echo "\t </div>\n";
}
}
같은 함수가 있다고 가정 그리고 나는 그것을 여러 번 호출 오전 :이 기능 전달에 하나 개의 통화를 할 수있는 방법을
crear('title1', 'Title 1','odd', 'input', '50', 0);
crear('title2', 'Title 2','even', 'input', '50', 0);
crear('title3', 'Title 3','odd', 'input', '30', 1);
crear('title4', 'Title 4','even', 'input', '50', 0);
crear('title5', 'Title 5','odd', 'select', '19', 1);
crear('title6', 'Title 6','even', 'select', '19', 0);
을 이 모든 데이터.
배열을 만들려고 생각했지만 기능을 수정해야합니다. 가장 좋은 방법은 무엇입니까? 내가 쉽게 추측 할 수있는 유일한 것은 홀수 필드이고, 다른 변수는 변수입니다.
'crear()'를 여러 번 호출하지만'fill()'을 정의합니까? 함수 자체를 수정하지 않으려면 데이터를 배열에 넣고 배열을 반복하고 루프 내에서 함수를 호출하십시오. –