COMMUNITY FORUM
Search Results (Searched for: k2 Tag)
- Panagiotis Sakellariou
How to add k2 rating to search results?
Category: English K2 Community
I've been trying to customise my search results page and while I managed to load the rating system for any k2 items that appear in a search, it loads as if noone has voted, and when you click to vote, it then loads the correct amount of votes.
Below is my default_results.php (of joomla's com_search, template override).
<?php defined('_JEXEC') or die('Restricted access'); ?><?php function getK2Images( $item) { jimport('joomla.filesystem.file'); //Image $arr_return = array(); if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_XS.jpg')) $arr_return = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_XS.jpg'; if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_S.jpg')) $arr_return = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_S.jpg'; if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_M.jpg')) $arr_return = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_M.jpg'; if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_L.jpg')) $arr_return = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_L.jpg'; if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_XL.jpg')) $arr_return = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_XL.jpg'; if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_Generic.jpg')) $arr_return = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_Generic.jpg'; return $arr_return; }?><?php ?><table class="contentpaneopen<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> <tr> <td> <?php $db = JFactory::getDBO(); foreach( $this->results as $result ) : ?> <?php $image =""; if(isset($result->extra_fields_search)) { $query = " SELECT i.id,i.title, i.metadesc, i.featured, i.featured_ordering, i.metakey, c.name as section, i.image_caption, i.image_credits, i.video_caption, i.video_credits, i.extra_fields_search, i.created, i.introtext as text, CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(':', i.id, i.alias) ELSE i.id END as slug, CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as catslug FROM #__k2_items AS i INNER JOIN #__k2_categories AS c ON c.id=i.catid WHERE i.id = ". $result->id; $db->setQuery($query); $item = $db->loadObject(); if(!empty($item)) { $arr_k2image = getK2Images($item); $image = isset($arr_k2image["imageGeneric"])?$arr_k2image["imageGeneric"]:""; } } ?> <fieldset> <div class="sea1"> <span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> <?php echo $this->pagination->limitstart + $result->count.'. ';?> </span> <?php if ( $result->href ) : if ($result->browsernav == 1 ) : ?> <a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component" target="_blank"> <?php else : ?> <a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component"> <?php endif; echo $this->escape($result->title); if ( $result->href ) : ?> </a> <?php endif; if ( $result->section ) : ?> <br /> <span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> (<?php echo $this->escape($result->section); ?>) </span> <?php endif; ?> <?php endif; ?> </div> <!-- Item Rating --> <div class="catItemRatingBlock"> <span><?php echo JText::_('Rate this item'); ?></span> <div class="itemRatingForm"> <ul class="itemRatingList"> <li class="itemCurrentRating" id="itemCurrentRating<?php echo $result->id; ?>" style="width:<?php echo $result->votingPercentage; ?>%;"></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('1 star out of 5'); ?>" class="one-star">1</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('2 stars out of 5'); ?>" class="two-stars">2</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('3 stars out of 5'); ?>" class="three-stars">3</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('4 stars out of 5'); ?>" class="four-stars">4</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('5 stars out of 5'); ?>" class="five-stars">5</a></li> </ul> <div id="itemRatingLog<?php echo $result->id; ?>" class="itemRatingLog"><?php echo $result->numOfvotes; ?></div> <div class="clr"></div> </div> <div class="clr"></div> </div> <?php if ( $result->featured == 1) : ?> <span class="feat"> <sup> <?php echo '<img class="sear" src="/images/stories/featuredItem.png" title="Designer" alt="Designer" />'; ?> </sup> </span> <?php endif; ?> <div> <div class="result_image"> <?php if(!empty($image)) { ?><a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component" title="<?php echo $result->title;?>"> <img class="search_image" src="<?php echo $image; ?>" alt="<?php echo $result->title; ?>" width="200px" height="auto"/></a> <?php } ?> </div> <div class="catItemIntroText"> <?php echo JHTML::_('content.prepare', $result->text); ?> </div> </div> </fieldset> <?php endforeach; ?> </td> </tr> <tr> <td colspan="3"> <div align="center"> <?php echo $this->pagination->getPagesLinks( ); ?> </div> </td> </tr></table>
I believe the problem is at line 116 and 123, and more specifically the votingPercentage @ line 116 and the numOfvotes @ line 123. (I have bolded the 2 lines of code).
How can I fix that? Any help will be greatly appreciated.
p.s. The code above contains hacks to show the item's image with a link, open title link and image link as popup, show the featured notice-graphic(if there is one), load content plugins that are being invoked with tags in introtext, show only introtext with full HTML and some more that I can't remember,
feel free to copy at will.
- Panagiotis Sakellariou
Rating/Voting in Joomla Search Results
Category: English K2 Community
I've been trying to customise my search results page and while I managed to load the rating system for any k2 items that appear in a search, it loads as if noone has voted, and when you click to vote, it then loads the correct amount of votes.
Below is my default_results.php (of joomla's com_search, template override).
<?php defined('_JEXEC') or die('Restricted access'); ?><?php function getK2Images( $item) { jimport('joomla.filesystem.file'); //Image $arr_return = array(); if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_XS.jpg')) $arr_return = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_XS.jpg'; if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_S.jpg')) $arr_return = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_S.jpg'; if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_M.jpg')) $arr_return = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_M.jpg'; if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_L.jpg')) $arr_return = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_L.jpg'; if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_XL.jpg')) $arr_return = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_XL.jpg'; if (JFile::exists(JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.md5("Image".$item->id).'_Generic.jpg')) $arr_return = JURI::root().'media/k2/items/cache/'.md5("Image".$item->id).'_Generic.jpg'; return $arr_return; }?><?php ?><table class="contentpaneopen<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> <tr> <td> <?php $db = JFactory::getDBO(); foreach( $this->results as $result ) : ?> <?php $image =""; if(isset($result->extra_fields_search)) { $query = " SELECT i.id,i.title, i.metadesc, i.featured, i.featured_ordering, i.metakey, c.name as section, i.image_caption, i.image_credits, i.video_caption, i.video_credits, i.extra_fields_search, i.created, i.introtext as text, CASE WHEN CHAR_LENGTH(i.alias) THEN CONCAT_WS(':', i.id, i.alias) ELSE i.id END as slug, CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as catslug FROM #__k2_items AS i INNER JOIN #__k2_categories AS c ON c.id=i.catid WHERE i.id = ". $result->id; $db->setQuery($query); $item = $db->loadObject(); if(!empty($item)) { $arr_k2image = getK2Images($item); $image = isset($arr_k2image["imageGeneric"])?$arr_k2image["imageGeneric"]:""; } } ?> <fieldset> <div class="sea1"> <span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> <?php echo $this->pagination->limitstart + $result->count.'. ';?> </span> <?php if ( $result->href ) : if ($result->browsernav == 1 ) : ?> <a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component" target="_blank"> <?php else : ?> <a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component"> <?php endif; echo $this->escape($result->title); if ( $result->href ) : ?> </a> <?php endif; if ( $result->section ) : ?> <br /> <span class="small<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> (<?php echo $this->escape($result->section); ?>) </span> <?php endif; ?> <?php endif; ?> </div> <!-- Item Rating --> <div class="catItemRatingBlock"> <span><?php echo JText::_('Rate this item'); ?></span> <div class="itemRatingForm"> <ul class="itemRatingList"> <li class="itemCurrentRating" id="itemCurrentRating<?php echo $result->id; ?>" style="width:<?php echo $result->votingPercentage; ?>%;"></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('1 star out of 5'); ?>" class="one-star">1</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('2 stars out of 5'); ?>" class="two-stars">2</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('3 stars out of 5'); ?>" class="three-stars">3</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('4 stars out of 5'); ?>" class="four-stars">4</a></li> <li><a href="#" rel="<?php echo $result->id; ?>" title="<?php echo JText::_('5 stars out of 5'); ?>" class="five-stars">5</a></li> </ul> <div id="itemRatingLog<?php echo $result->id; ?>" class="itemRatingLog"><?php echo $result->numOfvotes; ?></div> <div class="clr"></div> </div> <div class="clr"></div> </div> <?php if ( $result->featured == 1) : ?> <span class="feat"> <sup> <?php echo '<img class="sear" src="/images/stories/featuredItem.png" title="Designer" alt="Designer" />'; ?> </sup> </span> <?php endif; ?> <div> <div class="result_image"> <?php if(!empty($image)) { ?><a class="modal" rel="{handler:'iframe',size:{x:800,y:600}}" href="<?php echo JRoute::_($result->href); ?>?tmpl=component" title="<?php echo $result->title;?>"> <img class="search_image" src="<?php echo $image; ?>" alt="<?php echo $result->title; ?>" width="200px" height="auto"/></a> <?php } ?> </div> <div class="catItemIntroText"> <?php echo JHTML::_('content.prepare', $result->text); ?> </div> </div> </fieldset> <?php endforeach; ?> </td> </tr> <tr> <td colspan="3"> <div align="center"> <?php echo $this->pagination->getPagesLinks( ); ?> </div> </td> </tr></table>
I believe the problem is at line 116 and 123, and more specifically the votingPercentage @ line 116 and the numOfvotes @ line 123. (I have bolded the 2 lines of code).
How can I fix that? Any help will be greatly appreciated.
p.s. The code above contains hacks to show the item's image with a link, open title link and image link as popup, show the featured notice-graphic(if there is one), load content plugins that are being invoked with tags in introtext, show only introtext with full HTML and some more that I can't remember,
feel free to copy at will.
- Jiliko.net
CSS4K2 problem...
Category: English K2 Community
It can't as K2 doesn't call plugin events on item list by tag.
All pages using the K2 generic view have the same constraint.
Olivier
- Scotty
CSS4K2 problem...
Category: English K2 Community
I'm using CSS4K2 and it's working great except when I click a tag and I get a list of items sharing that tag...
index.php?option=com_k2&view=itemlist&task=tag&tag=SILVER&Itemid=70
CSS4K2 is not loading my custom css on these pages.
The plugin...
<?php/*
# plg_onecssperk2template - CSS4K2 K2 plugin#
# author Jiliko.net# copyright Copyright (C) 2010 Jiliko.net. All Rights Reserved.# @license - www.gnu.org/licenses/gpl-2.0.html GNU/GPL# Websites: http://www.jiliko.net# Technical Support: Forum - www.jiliko.net/forum
*/// no direct accessdefined('_JEXEC') or die('Restricted access');JLoader::register('K2Plugin',JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'lib'.DS.'k2plugin.php');class plgK2OneCssPerK2Template extends K2Plugin { // Some params var $pluginName = 'oneCssPerK2Template'; var $pluginNameHumanReadable = 'One Css Per K2 Template'; function plgK2OneCssPerK2Template(&$subject, $params) { parent::__construct($subject, $params); } function onK2PrepareContent( & $item, & $params, $limitstart) { global $mainframe; } function onK2AfterDisplay( & $item, & $params, $limitstart) { global $mainframe; return ''; } function onK2BeforeDisplay( & $item, & $params, $limitstart) { global $mainframe; return ''; } function onK2AfterDisplayTitle( & $item, & $params, $limitstart) { global $mainframe; return ''; } function onK2BeforeDisplayContent( & $item, & $params, $limitstart) { global $mainframe; return ''; } function onK2AfterDisplayContent( & $item, & $params, $limitstart) { global $mainframe; //We load the plugin parameters $plugin =& JPluginHelper::GetPlugin('k2', 'onecssperk2template'); $pluginParams = new JParameter($plugin->params); // Call loadCss function if we're in the k2 item view $view=JRequest::getCmd('view'); if ($pluginParams->get('multiCss',0)) $this->loadCss($item->params); else $this->loadCss($params); return ''; } function onK2CategoryDisplay( & $category, & $params, $limitstart) { global $mainframe; // Call loadCss function if we're in the k2 itemlist view $view=JRequest::getCmd('view'); if($view == 'itemlist') $this->loadCss($params); return ''; } function onK2UserDisplay( & $user, & $params, $limitstart) { global $mainframe; // Call loadCss function if we're in the k2 itemlist view $view=JRequest::getCmd('view'); if($view == 'itemlist') $this->loadCss($params); return ''; } function onK2SherpaSearchDisplay( & $search, & $params, $limitstart) { global $mainframe; $this->loadCss($params); return ''; } function loadCss($params) { global $mainframe; jimport('joomla.filesystem.file'); $theme = $params->get('theme',''); if($theme == '') $theme = 'default'; $doc = & JFactory::getDocument(); //We add the css file to the head of the document. //Testing where to get the custom K2 template css if (JFile::exists(JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.$theme.DS.$theme.'_style.css')) $doc->addStyleSheet(JURI::base().'templates/'.$mainframe->getTemplate().'/html/com_k2/'.$theme.'/'.$theme.'_style.css'); elseif (JFile::exists(JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates'.DS.$theme.DS.$theme.'_style.css')) $doc->addStyleSheet(JURI::base().'templates/'.$mainframe->getTemplate().'/html/com_k2/templates/'.$theme.'/'.$theme.'_style.css'); elseif (JFile::exists(JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'templates'.DS.$theme.DS.$theme.'_style.css')) $doc->addStyleSheet(JURI::base().'components/com_k2/templates/'.$theme.'/'.$theme.'_style.css'); //We load the plugin parameters $plugin =& JPluginHelper::GetPlugin('k2', 'onecssperk2template'); $pluginParams = new JParameter($plugin->params); //If we DON'T want to keep the k2 css loaded if(!$pluginParams->get('keepk2css',1)) { //We load the head data of the document in an array $tabHead = $doc->getHeadData(); //For each stylesheets loaded, we check the key (the path & name of the css file) foreach($tabHead as $key => $styleSheet){ if( strpos($key, '/k2.css')) { //The entry of the css file is deleted unset($tabHead[$key]); break; } } //The new head data is loaded in the document $doc->setHeadData($tabHead); } } } // END CLASS
Anyone know where to edit that it does load on these pages?
- George Vouliakis
K2 Tag cloud does not work if a tag is a number
Category: English K2 Community
Hello Sergey,
This is an old post! I managed to solve this issue but I forgot to post it here.
Try the following solution (which I think its better):
In the file helper.php in /modules/mod_k2_tools (/modules/mod_k2_tools/helper.php)at line 197 add true as last parameter to array_slice php function. The code at line 197 is:
$cloud = array_slice($cloud, 0, $params->get('cloud_limit'));
Add the true as last parameter of array_slice function:
$cloud = array_slice($cloud, 0, $params->get('cloud_limit'), true);
and remove your code.Anyway thanks for trying to solve the issue.Regards,George
- Sergey Zaika
K2 Tag cloud does not work if a tag is a number
Category: English K2 Community
Here is my dirty code to fix it.
File: /modules/mod_k2_tools/helper.php
Change this row around number 197:
$cloud = array_slice($cloud, 0, $params->get('cloud_limit'));
to this:
$cloud_keys = array_keys($cloud); $counter = 0; $temp_cloud = $cloud; $cloud = array(); foreach ($temp_cloud as $cloudlet) { if ($counter < $params->get('cloud_limit')) $cloud[$cloud_keys[$counter]] = $cloudlet; $counter++; }
It would help.
- Odin Mayland
k2 item's image rotator by tags
Category: English K2 Community
- william white
problem with saved items text
Category: English K2 Community
If it does, look at jce settings and also at the k2 paramaters to see if there is anything set to strip them out of your output
- Feanor Finwe
K2 item in Multiple Categories
Category: English K2 Community
Feanor Finwe said:
In developmii mod is bug - first you must create some content in joomla and then import to K2 (else in the categories aren't items). Then it work fine :)
- Feanor Finwe
Categories multi-mapping
Category: English K2 Community
Feanor Finwe said:
In developmii mod is bug - first you must create some content in joomla and then import to K2 (else in the categories aren't items). Then it work fine :)
- Feanor Finwe
Subcatogeries /items in multiple categories??
Category: English K2 Community
Feanor Finwe said:
In developmii mod is bug - first you must create some content in joomla and then import to K2 (else in the categories aren't items). Then it work fine :)
- Feanor Finwe
K2 categories and product selection
Category: English K2 Community
Feanor Finwe said:
In developmii mod is bug - first you must create some content in joomla and then import to K2 (else in the categories aren't items). Then it work fine :)
- Feanor Finwe
K2 categories and product selection
Category: English K2 Community
Feanor Finwe said:
In developmii mod is bug - first you must create some content in joomla and then import to K2 (else in the categories aren't items). Then it work fine :)
- Feanor Finwe
Articles in multiple Categories...how?
Category: English K2 Community
Feanor Finwe said:
In developmii mod is bug - first you must create some content in joomla and then import to K2 (else in the categories aren't items). Then it work fine :)
- Feanor Finwe
Items in Multiple Categories
Category: English K2 Community
Feanor Finwe said:
In developmii mod is bug - first you must create some content in joomla and then import to K2 (else in the categories aren't items). Then it work fine :)
- Adamo
Tag menu item: multi tag as filter
Category: English K2 Community
See, for example, those topics:
community.getk2.org/forum/topics/multiple-tag-menu-item?comm...
community.getk2.org/forum/topics/add-a-category-made-by-tags...
community.getk2.org/forum/topics/how-can-i-add-an-article-to...
To avoid duplicate content issues it could be possible to use the canonical meta tag based on the primary category (the others are secondary). And the primary category could be used also for the SEF url.
So, inserting an article in multiple categories and selecting multiple tag in menu items, K2 will be really flexible (and better than Joomla! itself that permits to set only one category and non tags!).
- Jakovlev
[Solved] SIG Pro popup engines and K2 image gallery
Category: Simple Image Gallery PRO
Did you solve your issue? ..cause as far as I can see both galleries works...
Both galleries works, but every uses different pop-engine and layout template. When I change plugin preferences, it affects only galleries with tag {gallery}. But it’s doesn’t affect a presence of K2 galleries. That’s what I need to fix.
- Jakovlev
[Solved] SIG Pro popup engines and K2 image gallery
Category: Simple Image Gallery PRO
@Jakovlev
What do you mean the the tags no longer work? In which version of Joomla?
Sorry, it's not what I exactly want to write. Better I'll show you live examples. It's gallery made by K2 Gallery tab in article editor:
www.luxury-magazine.ru/stil/stilnye-mira-sego_2807.html
And here is galleries made by {gallery} tag:
www.luxury-magazine.ru/obraz-zhizni/zhiznennoe-prostranstvo/svet-s-vostoka_1878.html
You see, it's totally different behavior. I need both of them working the same (like with {gallery} tag). JWSIG plugin is set to use FancyBox.
PS: Joomla is 1.5.23, K2 is 2.4.1
- Anne-Marie Pollowy Toliver
K2 Content module+CSS & HTML Formatting disappears?
Category: English K2 Community
Is there some way to add some formatting? At least increase the space between the items?
Or, is there some other way to accomplish the same thing?
I am NOT into css at all.
To see current format and problem see: seniorslongtermcare.info
- Agnelo Quelhas
K2 extra fields and Tags conflict
Category: English K2 Community
I have a curious bug in a website with K2.
We have a number of tags wich have the same name of some extra fields. In the Tags search, the ones with the same name of the extra fields, did not return any results, although they are associated to some items...
If I put some character in addition to the name, (ex. an *), it all works well.
Seems like a conflict between Tags and extra fields with the same name...
Is this strange or what?
Any one with the same problem... any solution?
AQ