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:"&"|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?
Posts: 8601
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.
Posts: 84
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:"&"|ireplace:$form.searchCriteria:"<span class=\"giSearchHighlight\">\\1</span>"|markup} </p> {else if $field.key == 'Summary'} <p class = "giDescription"> {$field.value|default:"&"|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!
Posts: 36
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
Posts: 36
anyone?
Posts: 36
still looking for some help on this?
Posts: 16504
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
Posts: 36
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
Posts: 8601
just search for
{foreach from=$result.fields item=field}in SearchShowAll.tpl and you'll find the right spot.Posts: 36
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
Posts: 16504
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
Posts: 8601
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.
Posts: 36
WOOHOO thanx a bunch Mindless!!!!
It worked and you rule!
JW
Posts: 26
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]);Posts: 104
In the first solution I'm not sure why he used & ?? That just produces a "&" when there is no title or description. Instead I would just change it to   which is the code for a space. Thanks for the solutions dsawchuk and mindless
--
http://ChristianJamesPhoto.com