- Posts: 6218
COMMUNITY FORUM
How to change tag view options?
- JoomlaWorks
- Offline
- Admin
Change it to:
<?php
// Tags
if (
($view == 'item' && ($item->params->get('itemTags') || $item->params->get('itemRelated'))) ||
($view == 'itemlist' && ($task == '' || $task == 'category') && $item->params->get('catItemTags')) ||
($view == 'itemlist' && $task == 'user' && $item->params->get('userItemTags')) ||
($view == 'latest' && $params->get('latestItemTags')) ||
($view == 'itemlist' && $task == 'tag') /* Tag layout check */
) {
$tags = $this->getItemTags($item->id);
for ($i = 0; $i < sizeof($tags); $i++) {
$tags[$i]->link = JRoute::_(K2HelperRoute::getTagRoute($tags[$i]->name));
}
$item->tags = $tags;
}
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Villy Koutsogianni
- Offline
- New Member
- Posts: 19
I have corrected the code as you suggested, but still no result.
It displays Also tagged under:
Is something wrong in tag.php?
<div class="catItemTags"><span><?php echo JText::_('Also tagged under: '); ?></span>
<?php foreach ($this->item->tags as $tag): ?>
<a href="<?php echo $tag->link; ?>"><?php echo $tag->name; ?></a>,
<?php endforeach; ?>
</div>
Thanks for your patience
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
- Posts: 6218
<?php if (isset($item->tags) && count($item->tags)): ?>
<div class="catItemTags">
<span><?php echo JText::_('Also tagged under'); ?>:</span>
<?php foreach ($item->tags as $tag): ?>
<a href="<?php echo $tag->link; ?>"><?php echo $tag->name; ?></a>,
<?php endforeach; ?>
</div>
<?php endif; ?>
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Villy Koutsogianni
- Offline
- New Member
- Posts: 19
I will try later to add 2 columns, rate, category etc I hope I will manage :)
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
- Posts: 6218
The item tags missing from the tag.php layout was something in our todo list. So given the chance today, I actually merged this into K2 core (in v2.9.1 dev): github.com/getk2/k2/archive/master.zip
I recommend you install on top as there are controls now in place in the K2 Settings for that (first tab there). Item tags in the tag layout will be enabled by default from now on.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Villy Koutsogianni
- Offline
- New Member
- Posts: 19
Do you mean category.item.php?Just copy the setup from category.php. Shouldn't be difficult.
Copying the parts needed of that file does not work
I suppose I must add an appropriate view check for rating and hits as well. Right?
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
- Posts: 6218
For hits and rating just get the code from "item.php" and simply swap any instance of "$this->item->" with "$item->".
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Villy Koutsogianni
- Offline
- New Member
- Posts: 19
It displays rating but with no rates at all.
If I vote for an item it then displays its total votes.
Here is the code
<?php if($item->params->get('itemRating')): ?>
<!-- Item Rating -->
<div class="itemRatingBlock">
<span><?php echo JText::_('K2_RATE_THIS_ITEM'); ?></span>
<div class="itemRatingForm">
<ul class="itemRatingList">
<li class="itemCurrentRating" id="itemCurrentRating<?php echo $item->id; ?>" style="width:<?php echo $item->votingPercentage; ?>%;"></li>
<li><a href="#" data-id="<?php echo $item->id; ?>" title="<?php echo JText::_('K2_1_STAR_OUT_OF_5'); ?>" class="one-star">1</a></li>
<li><a href="#" data-id="<?php echo $item->id; ?>" title="<?php echo JText::_('K2_2_STARS_OUT_OF_5'); ?>" class="two-stars">2</a></li>
<li><a href="#" data-id="<?php echo $item->id; ?>" title="<?php echo JText::_('K2_3_STARS_OUT_OF_5'); ?>" class="three-stars">3</a></li>
<li><a href="#" data-id="<?php echo $item->id; ?>" title="<?php echo JText::_('K2_4_STARS_OUT_OF_5'); ?>" class="four-stars">4</a></li>
<li><a href="#" data-id="<?php echo $item->id; ?>" title="<?php echo JText::_('K2_5_STARS_OUT_OF_5'); ?>" class="five-stars">5</a></li>
</ul>
<div id="itemRatingLog<?php echo $item->id; ?>" class="itemRatingLog"><?php echo $item->numOfvotes; ?></div>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
<?php endif; ?>
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
- Posts: 6218
Generally speaking, I would implement all these as a plugin to make sure core K2 is not modified and changes/improvements stick after updating K2.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Villy Koutsogianni
- Offline
- New Member
- Posts: 19
This is exactly what I was talking about
My hopes, for a future update :)It is a pity that for an obvious layout (tag view same as article view) one needs a 3rd party plg (that may not exist anymore) or else to hack the core K2 code.
Please Log in or Create an account to join the conversation.