نمایش نوع فایل در بخش Attachment در k2
يكشنبه, ۱۲ مرداد ۱۳۹۳، ۱۰:۴۷ ق.ظ
وارد این فایل شوید:
/components/com_k2/templates/default/item.php
کد زیر را پیدا کنید:
کد php:
<?php if($this->item->params->get('itemAttachments') && count($this->item->attachments)): ?>
کد زیر را به جای کد بالا قرار دهید:
کد php:
<?php if($this->item->params->get('itemAttachments') && count($this->item->attachments)): ?>
<!-- Item attachments -->
<div class="itemAttachmentsBlock">
<span><?php echo JText::_("Download attachments:"); ?></span>
<ul class="itemAttachments">
<?php foreach ($this->item->attachments as $attachment): ?>
<?php //Get file type string no matter how long the extension. CSS in K2.CSS to support each format.
$mimetype = ltrim(strstr($attachment->filename, "."),"."); ?>
<li>
<!-- Add a class to the link -->
<a class="<?php echo $mimetype;?>" title="<?php echo htmlentities($attachment->titleAttribute, ENT_QUOTES, 'UTF-8'); ?>" href="/<?php echo JRoute::_('index.php? option=com_k2&view=item&task=download&id='.$attachment->id); ?>"><?php echo $attachment->title ; ?> </a>
<?php if($this->item->params->get('itemAttachmentsCounter')): ?>
<span>(<?php echo $attachment->hits; ?>
<?php echo (count($attachment->hits)==1) ? JText::_("download") : JText::_("downloads"); ?>)</span>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
۹۳/۰۵/۱۲