How to display images in search results

    YoFlash's search plugin is able to show images in the search results. Unfortunately, teh default search component from Joomla does not offer this feature. However, with some  simple steps it is possible to display images in search results.

     

    A big part of this post are taken from PHOCAs explanation / documentation.

    With the help of template overrides you can manage to alter the results display page without hacking teh core joomla component. The original file can be found here: components/com_search/views/search/tmpl/default_results.php

    1. Copy all files from  "components/com_search/views/search/tmpl" to your template directory in the folder "templates/[YOUR-TEMPLATE]/html/com_search/search

    2. Edit the file "default_results.php" in the template folder

    The rest is taken from the PHOCA documentation. All credits belong to them.

     
    Add following code:
     
    <?php if (isset($result->image) && $result->image != '') {
    echo '<div style="float: left;margin: 5px 10px;"><img src="'. $this->escape($result->image).'" alt="" /></div>';
    } ?>
     
    before this code:

    <dt class="result-title">

    It is circa line 15
     
    and
     
    add following code:

    <?php if (isset($result->image) && $result->image != '') {

    echo '<div style="clear:both"></div>';

    } ?>

    after this code:

    <?php if ($this->params->get('show_date')) : ?>

    <dd class="result-created<?php echo $this->pageclass_sfx; ?>">

    <?php echo JText::sprintf('JGLOBAL_CREATED_DATE_ON', $result->created); ?>

    </dd>

    <?php endif; ?>

    It is circa line 38
     
    Afte ryou have saved the default_results.php thesmall thumbnail from yoflash games should appear in the search results as:
     
     

     

    Please publish modules in offcanvas position.