I have a problem with one of my modules for K2.
There is the code of the module which shows categories.
Actually it is modified k2tools (search box part):
Code: Select all
<?php
/**
* @version $Id: search.php 1492 2012-02-22 17:40:09Z [email protected] $
* @package K2
* @author JoomlaWorks http://www.joomlaworks.net
* @copyright Copyright (c) 2006 - 2012 JoomlaWorks Ltd. All rights reserved.
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
/*
Important note:
If you wish to use the live search option, it's important that you maintain the same class names for wrapping elements, e.g. the wrapping div and form.
*/
if($text=='categorieslayout'){
$mainframe = &JFactory::getApplication();
$user = &JFactory::getUser();
$aid = (int) $user->get('aid');
$db = &JFactory::getDBO();
switch ($params->get('categoriesListOrdering')) {
case 'alpha':
$orderby = 'name';
break;
case 'ralpha':
$orderby = 'name DESC';
break;
case 'order':
$orderby = 'ordering';
break;
case 'reversedefault':
$orderby = 'id DESC';
break;
default:
$orderby = 'id ASC';
break;
}
$catFilter=($categoryFilter)? "id IN(".$categoryFilter.") AND" : '';
$query = "SELECT * FROM `#__k2_categories` WHERE ".$catFilter." published=1 AND trash=0 ";
/*if(K2_JVERSION=='16'){
$query .= " AND access IN(".implode(',', $user->authorisedLevels()).") ";
if($mainframe->getLanguageFilter()) {
$languageTag = JFactory::getLanguage()->getTag();
$query .= " AND language IN (".$db->Quote($languageTag).", ".$db->Quote('*').") ";
}
}
else {
$query .= " AND access <= {$aid}";
}*/
$query .= " ORDER BY {$orderby}";
$db->setQuery($query);
$rows = $db->loadObjectList();
//var_Dump( $query );
?>
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2SearchBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); if($params->get('liveSearch')) echo ' k2LiveSearchBlock'; ?>">
<?php
echo '<table class="k2ModuleBoxCatsLayout"><tbody>';
foreach($rows as $k=>$row){
if($k%3==0){
echo "<tr>";
}
echo "<td>";
$img = ($row->image)? '<img class="catImg" src="'.JURI::root().'media/k2/categories/'.$row->image.'" />' : '';
echo '<a href="'.urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($row->id.':'.urlencode($row->alias)))).'">'.$img.'<div class="catTitle">'.$row->name.'</div></a>';
echo "</td>";
if(($k+1)%3==0) echo "</tr>";
}
if(($k+1)%3!=0) echo str_repeat('<td class="noitem"></td>', (3-(($k+1)%3))). "</tr>";
echo '</tbody></table>';
echo '</div>';
}else{
?>
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2SearchBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); if($params->get('liveSearch')) echo ' k2LiveSearchBlock'; ?>">
<form action="<?php echo JRoute::_('index.php?option=com_k2&view=itemlist&task=search'); ?>" method="get" autocomplete="off" class="k2SearchBlockForm">
<input type="text" value="<?php echo $text; ?>" name="searchword" maxlength="<?php echo $maxlength; ?>" size="<?php echo $width; ?>" alt="<?php echo $button_text; ?>" class="inputbox" onblur="if(this.value=='') this.value='<?php echo $text; ?>';" onfocus="if(this.value=='<?php echo $text; ?>') this.value='';" />
<?php if($button): ?>
<?php if($imagebutton): ?>
<input type="image" value="<?php echo $button_text; ?>" class="button" onclick="this.form.searchword.focus();" src="<?php echo JURI::base(true); ?>/components/com_k2/images/fugue/search.png" />
<?php else: ?>
<input type="submit" value="<?php echo $button_text; ?>" class="button" onclick="this.form.searchword.focus();" />
<?php endif; ?>
<?php endif; ?>
<input type="hidden" name="categories" value="<?php echo $categoryFilter; ?>" />
<?php if(!$app->getCfg('sef')): ?>
<input type="hidden" name="option" value="com_k2" />
<input type="hidden" name="view" value="itemlist" />
<input type="hidden" name="task" value="search" />
<?php endif; ?>
<?php if($params->get('liveSearch')): ?>
<input type="hidden" name="format" value="html" />
<input type="hidden" name="t" value="" />
<input type="hidden" name="tpl" value="search" />
<?php endif; ?>
</form>
<?php if($params->get('liveSearch')): ?>
<div class="k2LiveSearchResults"></div>
<?php endif; ?>
</div>
<?php
}
Code: Select all
foreach($rows as $k=>$row){
PS: there is the search.php file
http://www42.zippyshare.com/v/66814139/file.html