customizing search results in SearchShowAll.tpl

dsawchuk

Joined: 2005-01-22
Posts: 84
Posted: Mon, 2005-04-11 04:43

When a user searches using the default options, after each image, the values of 'title,' 'summary,' etc. are displayed. I was hoping to change it so that the title and summary were displayed (hopefully in the same styles as in a normal album view - byt that's currently a 'nice to have').

The biggest reason I want to do this is because the results page gets pretty messy when there is a longer description for a given image.

So, I think I have found the place in SearchShowAll.tpl where the descriptions are printed:

		<ul class="giInfo">
		  {foreach from=$result.fields item=field}
		  <li>
		    {$field.key}:
		    {$field.value|default:"&amp;"|ireplace:$form.searchCriteria:"<span class=\"giSearchHighlight\">\\1</span>"|markup}
		  </li>
		  {/foreach}
		</ul>

Unfortunately, I can't seem to wrap my head around everything that's going on here (smarty code seems to baffle me a bit).

So, what changes would I make to this block to have it display only the title and summary? Or, better yet, how could I get it to display the same information as what's being displayed in a normal album view?

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2005-04-11 14:51

each search implementation returns what fields to display with the thumbnail, usually to show what was matched from the search string. so you can either modify modules/core/classes/GalleryCoreSearch.class or put something like {if $field.key != 'Description'}...{/if} in your local tpl, but that may be an english-only solution as $field.key is localized.

 
dsawchuk

Joined: 2005-01-22
Posts: 84
Posted: Tue, 2005-04-12 01:31

Thanks a bunch mindless! That last bit got me on the right track.

Here is the code I ended up using:

		  {foreach from=$result.fields item=field}
		  {if $field.key != 'Description' && $field.key != 'Owner' && $field.key != 'Keywords'}
		  {if $field.key == 'Title'}
		  <p class ="giTitle">{if $SearchShowAll.items.$itemId.canContainChildren}Album: {/if}{$field.value|default:"&amp;"|ireplace:$form.searchCriteria:"<span class=\"giSearchHighlight\">\\1</span>"|markup}
		  </p>
		  {else if $field.key == 'Summary'}
		  <p class = "giDescription">
		    {$field.value|default:"&amp;"|ireplace:$form.searchCriteria:"<span class=\"giSearchHighlight\">\\1</span>"|markup}
		  </p>
		  {/if}
		  {/if}
		  {/foreach}

Maybe it could be tightened up a bit, but it's working!

 
Johnworfin
Johnworfin's picture

Joined: 2005-09-15
Posts: 36
Posted: Fri, 2005-09-16 19:01

I have also having issues with how my search data is displayed.

I would like to try to use this fix, but I need sommore info about how to go about doing this? The final piece of code goes where? and in what page?

thx for the help!
JW

 
Johnworfin
Johnworfin's picture

Joined: 2005-09-15
Posts: 36
Posted: Wed, 2005-09-21 22:55

anyone?

 
Johnworfin
Johnworfin's picture

Joined: 2005-09-15
Posts: 36
Posted: Thu, 2005-10-13 20:32

still looking for some help on this?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2005-10-14 07:53

It appears he edited /modules/search/templates/SearchShowAll.tpl I'm not sure where exactly in that file though. But before you edit it copy it to /modules/serach/templates/local/SearchShowAll.tpl

____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
Johnworfin
Johnworfin's picture

Joined: 2005-09-15
Posts: 36
Posted: Fri, 2005-10-14 12:43

Yea, thats what I have been doing all along, just to be safe.

I think I will wait a bit longer if anyone else can shed light on this problem.

thx again!
JW

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2005-10-19 16:56

just search for {foreach from=$result.fields item=field} in SearchShowAll.tpl and you'll find the right spot.

 
Johnworfin
Johnworfin's picture

Joined: 2005-09-15
Posts: 36
Posted: Wed, 2005-10-19 17:26

Well, I found the spot you were talking about and posted your code in from above...but it doesn't seem to change the search display for me???

link here:

http://meeks.com/gallery2/main.php

search for timbertech

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Wed, 2005-10-19 19:26

After you've changed the .tpl file and if you're not seeing your changes, try clearing the template cache. Site Admin > Maintenance >
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2005-10-19 19:30

try making a local SearchScan.tpl and edit that.
that's the tpl you see right after a search.. SearchShowAll is used if you click "show all" when there are many results.

 
Johnworfin
Johnworfin's picture

Joined: 2005-09-15
Posts: 36
Posted: Wed, 2005-10-19 19:50

WOOHOO thanx a bunch Mindless!!!!

It worked and you rule!

JW

 
noborders

Joined: 2004-09-29
Posts: 26
Posted: Mon, 2006-05-29 21:07

I just wanted to remove the owner field in search results.

I couldn't figure out how to edit SearchShowAll

but I got it to work by modifying modules/core/classes/GalleryCoreSearch.class by removing all of the lines below:

AND
          [GalleryUser::id] = [GalleryItem::ownerId]
$text['owner'] = $module->translate('Owner');
$fields[] = array('key' => $text['owner'],
			      'value' => !empty($result[1]) ? $result[1] : $result[2]);
 
ckawalek

Joined: 2005-01-25
Posts: 104
Posted: Mon, 2006-08-28 03:35

In the first solution I'm not sure why he used &amp; ?? That just produces a "&" when there is no title or description. Instead I would just change it to &nbsp; which is the code for a space. Thanks for the solutions dsawchuk and mindless

--
http://ChristianJamesPhoto.com