test
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • visualstar Friend
    #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,
    Phill

    virteer Friend
    #375024

    the default_results.php is exactly what you’ll need to change to make this happen

    visualstar Friend
    #375026

    And what do I need to change or add than ?
    Some more information anyone please ?

    Thnx

    thuanlq Friend
    #376104

    Hi 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

    visualstar Friend
    #377166

    Hi 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
    Phill

    visualstar Friend
    #377167

    This 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]

    visualstar Friend
    #377178

    SOLVED !

    The “<?php } ?>” code needs to be after “<?php endforeach; ?>” instead of before.

    Thnx anyway !

    Grtz Phill

    weichun Friend
    #424896

    Hi Thuanlq,

    Can you show us the code you added to display the K2 item image?
    And any additional K2 extra field item?

Viewing 8 posts - 1 through 8 (of 8 total)

This topic contains 8 replies, has 4 voices, and was last updated by  weichun 13 years, 1 month ago.

We moved to new unified forum. Please post all new support queries in our New Forum