简体   繁体   English

如何使用JHTML自定义编辑按钮

[英]How to customize the edit button with JHTML

In Joomla, at this page: /component/com_content/views/articles/tmpl/default.php 在Joomla的此页面上:/component/com_content/views/articles/tmpl/default.php

There is this code (about line 62): 有以下代码(关于第62行):

<?php if ($canEdit) : ?>
   <li class="edit-icon">
      <?php echo JHtml::_('icon.edit', $this->item, $params); ?>
   </li>
<?php endif; ?>

It shown only the edit icon, i want add next to icon, a text "Edit page". 它只显示了编辑图标,我想在图标旁边添加一个文本“编辑页面”。

PS: The text must be inside tag: Edit page PS:文本必须在标签内:编辑页面

How to do this? 这个怎么做?

You need to go to: 您需要转到:

components\com_content\helpers\icon.php

There on line 126 (in Joomla 2.5.9 ) you'll see 第126行 (在Joomla 2.5.9中 ),您会看到

$output = '<span class="hasTip" title="'.JText::_('COM_CONTENT_EDIT_ITEM').' :: '.$overlib.'">'.$button.'</span>';

You need to enter your text just after 您需要在之后输入文字

</span>

And save it. 并保存它。 But be aware- after updating Joomla this changes might be goes away ... 但请注意-更新Joomla之后, 此更改可能会消失 ...

!BUT! !但! The other solution can be done with jQuery- and you dont need to worry about updating. 另一个解决方案可以使用jQuery-完成,而您不必担心更新。 I can explain it too, if you need. 如果您需要,我也可以解释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM