在 php 代码中集成 history.back(-1)
integrating history.back(-1) in php code
我不是 php 开发人员,我对 html 有一定的了解。
我目前有这个代码
<div class="page-header">
<h1 class="<?php echo $this->item->backlink ? "backlink" : ""; ?>">
<?php echo $this->item->backlink ? '<a class="backtomap" href="' . $this->item->backlink . '">' . JText::_('COM_FOCALPOINT_BACK_TO_MAP') . '</a>' : "";
echo trim($this->item->title); ?>
</h1>
</div>
现在我想集成 history.back 功能来代替当前的
onclick="history.back(-1)"
这样生成的 html 看起来像
<a class="backtomap" href="#" onclick="history.back(-1)>' . JText::_('COM_FOCALPOINT_BACK_TO_MAP') . '</a>'
我试着到处更改代码,但没有正确的知识,它并没有真正起作用。
有人可以帮忙吗?
谢谢。
只是换行
'<a class="backtomap" href="' . $this->item->backlink . '">' . JText::_('COM_FOCALPOINT_BACK_TO_MAP') . '</a>'
和
'<a class="backtomap" href="#" onclick="history.back(-1)" >' . JText::_('COM_FOCALPOINT_BACK_TO_MAP') . '</a>'
我不是 php 开发人员,我对 html 有一定的了解。
我目前有这个代码
<div class="page-header">
<h1 class="<?php echo $this->item->backlink ? "backlink" : ""; ?>">
<?php echo $this->item->backlink ? '<a class="backtomap" href="' . $this->item->backlink . '">' . JText::_('COM_FOCALPOINT_BACK_TO_MAP') . '</a>' : "";
echo trim($this->item->title); ?>
</h1>
</div>
现在我想集成 history.back 功能来代替当前的
onclick="history.back(-1)"
这样生成的 html 看起来像
<a class="backtomap" href="#" onclick="history.back(-1)>' . JText::_('COM_FOCALPOINT_BACK_TO_MAP') . '</a>'
我试着到处更改代码,但没有正确的知识,它并没有真正起作用。
有人可以帮忙吗?
谢谢。
只是换行
'<a class="backtomap" href="' . $this->item->backlink . '">' . JText::_('COM_FOCALPOINT_BACK_TO_MAP') . '</a>'
和
'<a class="backtomap" href="#" onclick="history.back(-1)" >' . JText::_('COM_FOCALPOINT_BACK_TO_MAP') . '</a>'