Released Amazing Template for Phoca Cart
Learn More ...

Displaying Images In Joomla! Search Results

Category: Phoca Gallery Search Plugin
Search results in Joomla! are displayed by Joomla! Search component. Even if the Phoca Gallery Search plugin includes all necessary code to display images in search results, the last and important instance to display them is Joomla! Search Component.
To display Phoca Gallery images next to search results, the Joomla! Search component needs to be customized. All variables are prepared in the Phoca Gallery Search plugin, so the modifications in Search component are relatively easily feasible. In fact the modifications are only about design - how to design the search results.
Go to: components/com_search/views/search/tmpl/default_results.php and open this file in your editor. Make following changes:
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 cca line 15
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); ?>
	<?php endif; ?>
It is cca line 38
Now, your search results should look like result displayed on images below, medium thumbnails:
Phoca Gallery Search Results - Images 
Or small thumbnails:
Phoca Gallery Search Plugin - search outcomes - small thumbnails
This feature is available since version 4 (Joomla! 3)
Powered by Phoca