簡體   English   中英

在joomla模板中添加“編輯文章”按鈕

[英]Add “edit article” button in joomla template

我為Joomla 3.0創建了自己的模板。

我想為每個具有正確權限的用戶在任何頁面上顯示一個編輯按鈕(就像默認模板一樣),但是我不知道如何啟用它。

任何想法 ?

編輯:

我試圖將其添加到我的模板索引中:

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

但我收到以下錯誤:

Fatal error: Call to a member function authorise() on a non-object

它無法識別User對象。 您必須正確聲明User對象:

因此,您的代碼應以以下內容開頭:

$user = JFactory::getUser();
<?php if ($user->authorise('core.edit', 'com_content.article.'.$this->item->id)) : ?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM