Keyword

Limit Search results in ajax live search

  • Jesper
  • Jesper's Avatar Topic Author
  • Offline
  • New Member
More
11 years 11 months ago #104998 by Jesper
Hello

Im using the k2-tools module (search).

In the live search suggestions its displaying max 10 items but id like it to display maximum 4 items. I cant find an option for this in the module.

Is there a way to do this? a php limit string or something?

i attached an image on the search.

Thank you!

The code:

<?php if(count($this->items)): ?>
<ul id="liveSearchResults">

<div><span>Klicka "sök" för att visa alla resultat av din sökning.</span><a style="cursor:pointer; float:right; margin-bottom:5px;" onclick="setVisibility('liveSearchResults', 'none');"><img src="templates/stadsystem-template/images/close.png" /></a></div>

<div class="clr"></div>

<?php foreach($this->items as $item): ?>

<li style="border:solid 1px #f26822; padding:10px 10px 10px 0px;">

<div class="genericImageBlock" style="width:50px; display:block; float:left; margin:0 10px 0 5px;">

<img src="<?php echo $item->imageGeneric; ?>" alt="<?php if(!empty($item->image_caption)) echo K2HelperUtilities::cleanHtml($item->image_caption); else echo K2HelperUtilities::cleanHtml($item->title); ?>" style="width: 50px; height:auto;" />

</div>

<div class="genericbody" style="display:block;">
<span style="font-size:12px; font-weight:bold; display:block;"><a href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a></span>

<span style="font-size:11px; display:block;"><?php echo K2HelperUtilities::wordLimit($item->introtext,12); ?></span>

<!-- Item category -->
<div class="itemCategory" style="font-size:10px; display:block; margin-top:3px;">
<span><?php echo JText::_('K2_PUBLISHED_IN'); ?></span>
<a href="<?php echo $item->category->link; ?>"><?php echo $item->category->name; ?></a>
</div>

<div class="clr"></div>

</div>

</li>
<?php endforeach; ?>

</ul>
<?php endif; ?>
Attachments:

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum