《JoomlaExtesionDevelopment》书中关于第41页,关于后台中记录,按记录名链接进行编辑的功能实现,导入joomla.filter.output,然后使用其中的JOutputFilter类。在运行时,系统提示找不到该类。查阅资料后发现,最新版本的joomla已经根据现在的命名规范将包名改为joomla.filter.filteroutpu,类名改为JFilterOutput
<?php
function showReviews( $option, &$rows )
{
?>
<form action="index.php" method="post" name="adminForm">
<table class="adminlist">
<thead>
<tr>
<th width="20">
<input type="checkbox" name="toggle"
value="" οnclick="checkAll(<?php echo
count( $rows ); ?>);" />
</th>
<th class="title">Name</th>
<th width="15%">Address</th>
<th width="10%">Reservations</th>
<th width="10%">Cuisine</th>
<th width="10%">Credit Cards</th>
<th width="5%" nowrap="nowrap">Published</th>
</tr>
</thead>
<?php
//jimport('joomla.filter.output');
jimport('joomla.filter.filteroutput');//调整了命名规则,现改名为filteroutput
$k = 0;
for ($i=0, $n=count( $rows ); $i < $n; $i++)
{
$row = &$rows[$i];
$checked = JHTML::_('grid.id', $i, $row->id );
$published = JHTML::_('grid.published', $row, $i );
$link = JFilterOutput::ampReplace( 'index.php?option=' .$option . '&task=edit&cid[]='. $row->id );
?>
<tr class="<?php echo "row$k"; ?>">
<td>
<?php echo $checked; ?>
</td>
<td>
<a href="<?php echo $link; ?>">
<?php echo $row->name; ?>
</a>
</td>
<td>
<?php echo $row->address; ?>
</td>
<td>
<?php echo $row->reservations; ?>
</td>
<td>
<?php echo $row->cuisine; ?>
</td>
<td>
<?php echo $row->credit_cards; ?>
</td>
<td align="center">
<?php echo $published;?>
</td>
</tr>
<?php
$k = 1 - $k;
}
?>
</table>
<input type="hidden" name="option"
value="<?php echo $option;?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
</form>
<?php
}
?>