Steps/Methods
Open the Phpcms\modules\content\fields directory, copy the folder Downfiles, and rename it to Textgroups.
Open the phpcms\modules\content\fields\fields.inc.php file to increase the field type:
' textgroups ' + ' multiple file uploads ',
Open the Phpcms\modules\content\fields\textgroups directory (the first copy of the folder) and modify the following files:
form.inc.php
Function textgroups ($field, $value, $fieldinfo) {
Extract (String2array ($fieldinfo [' setting ']));
$list _str = ";
if ($value) {
$value = String2array (Html_entity_decode ($value, ent_quotes));
if (Is_array ($value)) {
foreach ($value as $_k=>$_v) {
$list _str. = "<div id= ' Textsgroups{$_k} ' > < Input type= ' text ' name= ' {$field}_fx[] ' value= ' {$_v[fx]} ' style= ' width:100px; ' class= ' Input-text ' > <input type= ' Text ' name= ' {$field}_fj[] ' value= ' {$_V[FJ]} ' style= ' width:100px; ' class= ' Input-text ' > <input type= ' text ' name= ' {$field}_cx[] ' value= ' {$_v[cx]} ' style= ' width:100px; ' class= ' Input-text ' > <input type= ' text ' name= ' {$field}_KD [] ' value= ' {$_V[KD]} ' style= ' width:100px; ' class= ' Input-text ' > <input type= ' text ' name= ' {$field}_vip[] ' value= ' {$_V[VIP]} ' style= ' width:100px; ' class= ' Input-text ' > <a href=\ ' javascript:remove_div (' textsgroups{$_k} ') \ " > ". L (' Remove_out '). " </a></div> ";
}
}
}
$string = ' <script type=text/javascript>
function Add_textsfile (Returnid) {
var ids = parseint (Math.random () * 10000);
var str = "<li id=\ ' textsgroups" +ids+ "\ ' > <input type=\ ' text\ ' name=\ '" +returnid+ "_fx[]\ ' value=\ ' \ ' style=\ ' Width:100px;\ ' class=\ ' input-text\ ' > <input type=\ ' text\ ' name=\ ' "+returnid+" _fj[]\ ' value=\ ' \ ' style=\ ' width : 100px;\ ' class=\ ' input-text\ ' > <input type=\ ' text\ ' name=\ ' "+returnid+" _cx[]\ ' value=\ ' \ ' style=\ ' width:100px ; \ ' class=\ ' input-text\ ' > <input type=\ ' text\ ' name=\ ' "+returnid+" _kd[]\ ' value=\ ' \ ' style=\ ' width:100px;\ ' Class=\ ' input-text\ ' > <input type=\ ' text\ ' name=\ ' "+returnid+" _vip[]\ ' value=\ ' \ ' style=\ ' width:100px;\ ' class =\ ' input-text\ ' > <a href=\ "javascript:remove_div (\ ' textsgroups ' +ids+" \ ') \ ">Remove</a> </li>" ;
$ (\ ' #\ ' +returnid). append (str);
}</script> ';
$string. = ' <input name= ' info[' $field. ' "type=" hidden "value=" 1 ">
<fieldset class= "Blue pad-10" >
<legend> '. L (' mm_fxlist '). ' </legend><div id= "tt" >
<input type= "text" value= "'. L (' Mm_fx '). ' "ReadOnly style=" width:100px;border:0; class= "Input-text" >
<input type= "text" value= "'. L (' mm_fj '). ' "ReadOnly style=" width:100px;border:0; class= "Input-text" >
<input type= "text" value= "'. L (' mm_cx '). ' "ReadOnly style=" width:100px;border:0; class= "Input-text" >
<input type= "text" value= "'. L (' MM_KD '). ' "ReadOnly style=" width:100px;border:0; class= "Input-text" >
<input type= "text" value= "'. L (' Mm_lyj '). ' "ReadOnly style=" width:100px;border:0; class= "Input-text" >
</div> ';
$string. = $list _str;
$string. = ' <ul id= ' $field. ' "class=" Piclist "></ul>
</fieldset>
<div class= "Bk10" ></div>
‘;
$string. = $str. " <input type=\ "button\" class=\ "button\" value=\ "". L (' mm_addfx '). " \ "Onclick=\" Add_textsfile (' {$field} ') \ ">";
return $string;
}
Modify input.inc.php
function textgroups ($field, $value) {
$hotel = $_post[$field. ' _fx '];
$hotel _FJ = $_post[$field. ' _FJ '];
$hotel _cx = $_post[$field. ' _cx '];
$hotel _KD = $_post[$field. ' _KD '];
$hotel _VIP = $_post[$field. ' _vip '];
$array = $temp = Array ();
if (!empty ($hotel)) {
foreach ($hotel as $key = = $hote) {
$temp [' fx '] = $hote;
$temp [' fj '] = $hotel _fj[$key];
$temp [' cx '] = $hotel _cx[$key];
$temp [' kd '] = $hotel _kd[$key];
$temp [' vip '] = $hotel _vip[$key];
$array [$key] = $temp;
}
}
$array = array2string ($array);
return $array;
}
Modified output.inc.php
function textgroups ($field, $value) {
Return String2array ($value);
}
Updates the background cache. Create a new field in the model, you can see the text group, and you can add it once created.
Foreground call:<table>
<tr><th> Room type </th><th> rate </th><th> bed type </th><th> Road Tour price </TH></TR >
{Loop $fxinfo $v} <!--$fxinfo field name--
<tr><td>{$v [fx]}</td><td>¥{$v [FJ]} meta </td><td>{$v [cx]}</td><td> <strong style= "color: #f60; font-size:18px;font-family:tahoma,helvetica,arial,sans-serif;" >¥{$v [vip]}</strong> Yuan </td></tr>
{/loop}
</table>
Precautions
[Phpcms V9 two-time development] custom field model-Add field type