-
AuthorPosts
-
February 1, 2011 at 7:48 pm #159628
Hi,
Is it possible to place a text for example: “No results found” when the visitor is searching something and it’s not found in the DB. I’am using the modded version of the “default_results.php” to view the images next to every item, this files is created by thuanlq and I download it from this support forum.
I don’t know it this file change has anything to do with it…Thnx for anyone who reply’s !
Grtz,
PhillFebruary 4, 2011 at 12:51 am #375024the default_results.php is exactly what you’ll need to change to make this happen
February 4, 2011 at 12:57 am #375026And what do I need to change or add than ?
Some more information anyone please ?Thnx
thuanlq Friendthuanlq
- Join date:
- October 2010
- Posts:
- 528
- Downloads:
- 0
- Uploads:
- 29
- Thanks:
- 8
- Thanked:
- 121 times in 99 posts
February 11, 2011 at 4:02 am #376104Hi Phill,
To place a text for example “No results found” into the”default_results.php” file, please make as following:
– Open and edit file “default_results.php” then replace the code:
<tr>
<td>
<?php
foreach( $this->results as $result ) : ?>
....
<?php endforeach; ?>
</td>
</tr>to
<tr>
<td>
<?php
if( count($this->results) == 0)
{
echo JText::_("No results found");
}
else
{
foreach( $this->results as $result ) : ?>
....
<?php } ?>
<?php endforeach; ?>
</td>
</tr>The “default_results.php” file which you downloaded, I edited this files to show “k2 item image” on search results page
February 17, 2011 at 1:35 pm #377166Hi Thuanlq,
First thank you for the support, my deadline is nearby 🙂
I’ve added/replaced the code as above but now my search results are not appearing anymore and I always get a blank page with in black letters: “Search”.
How can I solve this ?
Thank you for your help !
Grtz
PhillFebruary 17, 2011 at 1:36 pm #377167This is my current code:
[PHP]<?php defined(‘_JEXEC’) or die(‘Restricted access’); ?>
<table class=”contentpaneopen<?php echo $this->escape($this->params->get(‘pageclass_sfx’)); ?>”>
<tr>
<td>
<?php
if( count($this->results) == 0)
{
echo JText::_(“No results found”);
}
else
{
foreach( $this->results as $result ) : ?>
<fieldset>
<div>
<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 href=”<?php echo JRoute::_($result->href); ?>” target=”_blank”>
<?php else : ?>
<a href=”<?php echo JRoute::_($result->href); ?>”>
<?php endif;echo $this->escape($result->title);
if ( $result->href ) : ?>
</a>
<?php endif;
if ( $result->section ) : ?>
<p>
<span class=”small<?php echo $this->escape($this->params->get(‘pageclass_sfx’)); ?>”>
(<?php echo $this->escape($result->section); ?>)
</span>
</p>
<?php endif; ?>
<?php endif; ?>
</div>
<div>
<div class=”result_image”>
<?php
if(!empty($result->image))
{
?>
<img src=”<?php echo $result->image; ?>” alt=”<?php echo $result->title; ?>” title=”<?php echo $result->title;?>” width=”175px” height=”125px”/>
<?php
}
?>
</div>
<div class=”result_text”>
<?php echo $result->text; ?>
</div>
</div>
<?php
if ( $this->params->get( ‘show_date’ )) : ?>
<div class=”small<?php echo $this->escape($this->params->get(‘pageclass_sfx’)); ?>”>
<?php echo $result->created; ?>
</div>
<?php endif; ?>
</fieldset>
<?php } ?>
<?php endforeach; ?>
</td>
</tr>
<tr>
<td colspan=”3″>
<div align=”center”>
<?php echo $this->pagination->getPagesLinks( ); ?>
</div>
</td>
</tr>
</table>
[/PHP]February 17, 2011 at 2:38 pm #377178SOLVED !
The “<?php } ?>” code needs to be after “<?php endforeach; ?>” instead of before.
Thnx anyway !
Grtz Phill
-
AuthorPosts
This topic contains 8 replies, has 4 voices, and was last updated by weichun 13 years ago.
We moved to new unified forum. Please post all new support queries in our New Forum