// uses $this->_labelAlign, $this->_col2space, $this->_errorTxtColor, $this->_field, $this->_maxFields
// if $this->_field[$x]['rows'] > 0 assumes text area
public function formatRow ()
{
$output = '';
for ($x = 1; $x <= $this->_maxFields; $x++)
{
if ($this->_field[$x]['active'] == 'Y' || $this->_field[$x]['active'] == 'R') {
$name = 'mod_simpleemailform_field' . $x . '_' . $this->_instance;
$value = (isset($_POST[$name])) ? htmlspecialchars($_POST[$name]) : '';
// prevents Joomla from reformatting using javascript
if (strpos($value, '@')) {
$value = str_replace('@', '@', $value);
}
// 2011-12-03 DB: added CSS classes for input, table, row, th and td
$row = '';
$row .= '<tr' . $this->_trClass . '>';
// labels
$row .= "<th" . $this->_thClass . " align='" . $this->_labelAlign . "'>" . $this->_field[$x]['label'] . "</th>";
// space between cols
$row .= "<td" . $this->_spaceClass . " width='" . $this->_col2space . "'> </td>";
// input field
$row .= "<td" . $this->_tdClass . ">";
// check to see if text area
if ($this->_field[$x]['rows'] > 0) {
$row .= sprintf('<textarea name="%s" id="%s" rows="%d" cols="%d" %s>%s</textarea>',
$name,
$name,
$this->_field[$x]['rows'],
$this->_field[$x]['cols'],
$this->_inputClass,
$value);
} else {
$row .= sprintf('<input type="text" name="%s" id="%s" size="%d" value="%s" maxlength="%d" %s/>',
$name,
$name,
$this->_field[$x]['size'],
$value,
$this->_field[$x]['maxx'],
$this->_inputClass);
}
$row .= ($this->_field[$x]['error'])
? $this->formatErrorMessage($this->_errorTxtColor, $this->_field[$x]['error'])
: '';
$row .= "</td>";
$row .= "</tr>\n";
$output .= $row;
}
}
return $output;
}
这是我的输出模块代码,它以表格格式显示,我不希望这种类型的布局作为输出...我还尝试使用 tr、td 和 th 标签进行更改,但未能正确输出。 ..所以请如果有人帮我解决这个问题。
错误的格式输出我得到的
正确的格式输出我想要的