Many open-source program systems have custom form functions, such as Dream Weaving and empire. their custom form creates a new table, which is an implementation method, however, sometimes we may need some ancillary content or do not need to create multiple tables. we only want to store our data using one field... syntaxHighlighter. all ();
Many open-source program systems have custom form functions, such as Dream Weaving and empire. their custom form creates a new table, which is an implementation method, however, sometimes we may need additional content or do not need to create multiple tables. we only want to store the additional content through one field, at this time, we can achieve this through the following implementation method.
Let's take a look at the implementation results:
You can set the prompt text, field, type, default value, parameter, sorting, and whether the prompt text is displayed in the list. Of course, we can also add some similar display methods, such as whether to highlight them or not. The types include text, drop-down, single choice, check, and multi-line text. Let's take a look at the table structure:
No need to mention the Id. name is the form prompt text, that is, the name and gender. qian and ziduan are used in combination to better differentiate, using a prefix and field to form a custom field tag is easier to differentiate. type is the type, value is the default value, and whcs is the parameter, by default, this parameter takes effect only when its type is text or multi-line text. The first parameter sets the maximum number of bytes and the second limit length. Role indicates sorting, and yesno indicates whether it is displayed in the foreground.
You don't need to elaborate on the code. it's easy to set this custom form, that is, to traverse it and combine it according to its type.
Let me show you the code for this place.
[Php] view plaincopyprint? // Obtain parameter configuration information
$ System = $ this-> tmp_mod-> getAllSystem ();
If ($ system ){
Foreach ($ system as $ key => $ val ){
If ($ val ['name'] & $ val ['ziduany']) {
$ Zhu = '';
If ($ val ['value']) {
$ Value = @ explode (',', $ val ['value']);
}
If ($ val ['whcs ']) {
$ Whcs = @ explode ('$', $ val ['whcs ']);
}
If (2 = $ val ['type']) {
$ Zhu ='';Foreach ($ value as $ k => $ v ){$ Zhu. =''. $ V .'';}$ Zhu. ='';
} Elseif (3 = $ val ['type']) {
Foreach ($ value as $ k => $ v ){
$ Check = '';
If ('0' = $ k ){
$ Check = 'checked ';
}
$ Zhu. =''. $ V;
}
} Elseif (4 = $ val ['type']) {
Foreach ($ value as $ m =>$ n ){
$ Zhu. =''. $ N;
}
}
$ Biao [$ key] ['name'] = $ val ['name'];
Switch ($ val ['type']) {
Case '1': $ biao [$ key] ['value'] ='Maxlength = "'. $ whcs [0]. '"style =" width :'. $ whcs [1]. 'px "value = "'. $ val ['value']. '"/>'; break;
Case '2': $ biao [$ key] ['value'] = $ zhu; break;
Case '3': $ biao [$ key] ['value'] = $ zhu; break;
Case '4': $ biao [$ key] ['value'] = $ zhu; break;
Case 5: $ biao [$ key] ['value'] =''. $ Val ['value'].''; Break;
Default :;
}
}
}
}