-4

我有个问题:

这是代码块:

function draw()
{
    $out_string="";
    $out_string.=$this->script;
    reset($this->fields);
    $num_list_box=0;
    while( $field = each($this->fields) )
    {
    if (isset($this->fields[$field[1]->field]->options))
           {
           if (preg_match("/<script type=\"text\/javascript\">/i",$this->fields[$field[1]->field]->options[0][1])&& $this->fields[$field[1]->field]->value!="")
               {
               if ($num_list_box==0) $out_string.= "<script type=\"text/javascript\">levels.forValue(\"".$field_prev[0]."\").setDefaultOptions(\"".$this->fields[$field[1]->field]->value."\");</script>\n";
                   else $out_string.= "<script type=\"text/javascript\">levels.forValue(\"".$field_prev[0]."\").forValue(\"".$field_prev[1]."\").setDefaultOptions(\"".$this->fields[$field[1]->field]->value."\");</script>\n";
               $field_prev[]=$this->fields[$field[1]->field]->value;
               $num_list_box++;
               } else
               {
               $field_prev[0]=$this->fields[$field[1]->field]->value;
               $num_list_box=0;
               }

           }

    }

    $out_string.=$this->draw_title();
    $out_string.=$this->draw_header();
    $out_string.= "<table class=\"forms\">\n";
    $field=array_keys($this->fields);
    reset($field);
    $ind_first=true;
    while( list($pos,$field_name) = each($field) )
    {
       if ($this->num_cols>0) {
       if ($this->fields[$field_name]->col==1){
          if ($ind_first) $ind_first=false;else $out_string.="</tr>";
          $out_string.="<tr><td class=\"field_title\">";}
          else $out_string.="<td class=\"field_title\">";
       $out_string.= $this->fields[$field_name]->title."</td>";
       $colspan="";
       if ($this->num_cols>1) {
           if ($this->fields[$field_name]->col==1 && array_key_exists($pos+1,$field) && $this->fields[$field[$pos+1]]->col==1)
             $colspan="colspan=\"3\"";
          }
       $out_string.="<td class=\"field_value\" $colspan>";
       $out_string.=$this->fields[$field_name]->draw()."</td>";
       } else
       {
       if ($ind_first) $ind_first=false;else $out_string.="</tr>";
       $out_string.="<tr><td class=\"field_value\">".$this->fields[$field_name]->title."<br />";
       $out_string.=$this->fields[$field_name]->draw()."</td>";
       }
    }
    $out_string.= "</tr></table>\n";
    return $out_string;
}

上面的代码块产生如下内容:

在此处输入图像描述

我希望它在示例中假设“交易”一词位于文本框上方。

请帮忙,编写这部分程序的人身体不适,我们有最后期限。

谢谢您的帮助。

PS文本的CSS类名是:field_title文本框的类名是field_value

再次感谢。

4

2 回答 2

1

您将不得不调试该代码以找出标签“事务”何时插入到表代码的那团。一旦找到插入“事务”的位置,您就可以创建新逻辑以添加另一个跨表的 TR 并将标签放置在该新行上。

祝你好运,看起来很头疼。

于 2012-08-03T13:54:42.383 回答
0

Your code is apparently building a rather complex form based on some data ($fields property of the class). I guess some "field settings" (like col) describe how the form should look like.

So, your code is doing things that are neither described in your question nor in the code itself. Furthermore, we have no clue what the complete form currently looks like, so we can't even guess the intention of the code.

Your request, to let the description appear above the selection box(?) could be done probably throwing away half of the code, but that won't help you.

PS: Please check the FAQ - this site is for questions, not for finding people to do your (or elses) work. You should really have a programmer solve your problem directly having access to the whole page.

于 2012-08-03T14:03:17.573 回答