我们现在来看后台,模板描述的部分,也只有一个textarea,我们现在来加上一个所见即所得的编辑器。要加上所见即所得的编辑器,需要两个工作:
首先来修改 adminstrator/components/com_showcase/views/showcase/view.html.php ,在display 函数中加上:
$editor =& JFactory::getEditor();
$this->assignRef('editor', $editor);
接这,我们来修改上篇文章中的 models/showcase.xml ,将 description一行去掉。
最后,我们来修改 tmpl/form.php ,在<?php echo $this->html;?>这一行之后,加上:
<table width="100%" class="paramlist admintable" cellspacing="1">
<tr>
<td width="40%" class="paramlist_key">
<span class="editlinktip">
<label id="detailsdescription-lbl" for="detailsdescription" class="hasTip" title="Description::Description">Description</label>
</span>
</td>
<td class="paramlist_value">
<?php echo $this->editor->display('details[description]',$this->item->description, '400', '300','80','80 '); ?>
</td>
</tr>
</table>
注意一下,我们用到的输入域的名称。
现在看看后台整个修改和增加记录的界面吧。