bypassing searchScan.tpl for searchShowAll.tpl

dsawchuk

Joined: 2005-01-22
Posts: 84
Posted: Thu, 2005-04-07 02:07

I in the process of customizing G2 and I was hoping to have the search functionality skip the page generated by searchScan.tpl and go directly to searchShowAll.tpl.

What would be the best way of achieving this (hopefully without breaking anything else)?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Fri, 2005-04-08 06:20

Edit modules/search/templates/SearchSystemContent.tpl. Read the instructions at the top of the file to make a local copy first.

Replace this block:

   <div>
     {g->hiddenFormVars}
    <input type="hidden" name="{g->formVar var="view"}" value="{$SearchSystemContent.subView}"/>
    <input type="hidden" name="{g->formVar var="form[formName]"}" value="SearchSystemContent"/>
   </div>

with this:

   <div>
     {g->hiddenFormVars}
    <input type="hidden" name="{g->formVar var="view"}" value="search:SearchShowAll"/>
    <input type="hidden" name="{g->formVar var="form[formName]"}" value="SearchShowAll"/>
    <input type="hidden" name="{g->formVar var="form[moduleId]"}" value="GalleryCoreSearch"/>
    <input type="hidden" name="{g->formVar var="form[options][GalleryCoreSearch][descriptions]"}" value="1"/>
    <input type="hidden" name="{g->formVar var="form[options][GalleryCoreSearch][keywords]"}" value="1"/>
    <input type="hidden" name="{g->formVar var="form[options][GalleryCoreSearch][summaries]"}" value="1"/>
    <input type="hidden" name="{g->formVar var="form[options][GalleryCoreSearch][titles]"}" value="1"/>
   </div>

Then when you search from the sidebar it'll take you right to the advanced search.

 
dsawchuk

Joined: 2005-01-22
Posts: 84
Posted: Fri, 2005-04-08 23:27

Thanks. That works great for the sidebar search, but I think I need to modify another file somewhere. When I click 'advanced search' in the sidebar, the next search page will give results using searchScan.tpl.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Tue, 2005-04-12 19:09

You can try this patch. Unfortunately, it has to include *something* to search for because SearchShowAll expects that you've already done a search by this point and are expanding on the existing results. So I've hardcoded it to search for "foo".

This is a patch from the original source, so it includes my prior patch too.

 
AVSF

Joined: 2005-11-22
Posts: 40
Posted: Mon, 2005-12-12 15:28

Hello,
I can't find the searchSytemContent.tpl file in modules/search/templates directory... Are you sure it is the right name? or do I miss something??
Thank you for your help

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Mon, 2005-12-19 01:40

It probably changed. This is an old topic and the theme system had a major overhaul around July, 2005 and it looks like the rest of that information is out of date as well.

It appears you'd edit /modules/search/templates/blocks/SearchBlock.tpl, but I'm not sure what you'd put in there.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2006-10-31 00:20

SearchBlock.tpl is the file now, as nivekiam suggests. probably the same changes would still work.

 
skunker

Joined: 2005-02-04
Posts: 344
Posted: Thu, 2007-11-01 19:13

Is this code outdated? Im having a hard time making this work so the searchscan.tpl is skipped in favor of searchshowall.tpl. Here's my code:

<div class="{$class}">
<form id="search_SearchBlock" action="{g->url}" method="post" onsubmit="return search_SearchBlock_checkForm()">
<div>
{g->hiddenFormVars}
<input type="hidden" name="{g->formVar var="view"}" value="search.SearchScan"/>
<input type="hidden" name="{g->formVar var="form[formName]"}" value="search_SearchBlock"/>
<input type="text" id="searchCriteria" size="18"
name="{g->formVar var="form[searchCriteria]"}"
value="{g->text text=""}"
onfocus="search_SearchBlock_focus()"
onblur="search_SearchBlock_blur()"
class="textbox"/>
<button type="submit">Go</button>
<input type="hidden" name="{g->formVar var="form[useDefaultSettings]"}" value="1" />
</div>
{if $showAdvancedLink}
<div>
<a href="{g->url arg1="view=search.SearchScan" arg2="form[useDefaultSettings]=1"
arg3="return=1"}"
class="{g->linkId view="search.SearchScan"} advanced">{g->text text="Advanced Search"}</a>
</div>
{/if}
</form>
</div>

How do I get it to go straight to SearchShowAll.tpl?

 
sciway

Joined: 2008-03-17
Posts: 16
Posted: Thu, 2008-04-10 19:31

Any updates on this? I'm really looking to find out a way to get directly to the advanced search results page from the search box. Help please!?

Here is my info:
Gallery version = 2.2.4 core 1.2.0.6
PHP version = 4.3.9 apache2handler
Webserver = Apache/2.0.52 (Red Hat)
Database = mysqlt 4.1.20, lock.system=flock
Toolkits = ArchiveUpload, Gd, LinkItemToolkit, SquareThumb
Acceleration = full/604800, none/0
Operating system = Linux 141267-web2.sciway.net 2.6.9-55.0.9.ELsmp #1 SMP Tue Sep 25 02:17:24 EDT 2007 i686
Default theme = matrix
gettext = enabled
Locale = en_US
Browser = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11
Rows in GalleryAccessMap table = 9
Rows in GalleryAccessSubscriberMap table = 302
Rows in GalleryUser table = 2
Rows in GalleryItem table = 302
Rows in GalleryAlbumItem table = 27
Rows in GalleryCacheMap table = 660

 
id242

Joined: 2002-08-06
Posts: 2
Posted: Wed, 2008-07-02 21:38

The following code works well in gallery 2.2.5

in SearchBlock.tpl
REPLACE:

      {g->hiddenFormVars}
      <input type="hidden" name="{g->formVar var="view"}" value="search.SearchScan"/>
      <input type="hidden" name="{g->formVar var="form[formName]"}" value="search_SearchBlock"/>
      <input type="text" id="searchCriteria" size="18"

WITH:

      {g->hiddenFormVars}
      <input type="hidden" name="{g->formVar var="view"}" value="search.SearchShowAll"/>
      <input type="hidden" name="{g->formVar var="form[formName]"}" value="SearchShowAll"/>
      <input type="hidden" name="{g->formVar var="form[action][showAll][GalleryCoreSearch]"}" value="1"/>
      <input type="hidden" name="{g->formVar var="form[options][GalleryCoreSearch][titles]"}" value="1"/>
      <input type="hidden" name="{g->formVar var="form[options][GalleryCoreSearch][descriptions]"}" value="1"/>
      <input type="text" id="searchCriteria" size="18"
 
Sfinxweb

Joined: 2008-07-22
Posts: 6
Posted: Sat, 2008-08-02 09:39

After changing the code, keyword search came up empty.

After adding the following line it work perfectly.

<input type="hidden" name="{g->formVar var="form[options][GalleryCoreSearch][keywords]"}" value="1"/>

 
derickson

Joined: 2006-04-13
Posts: 32
Posted: Wed, 2009-04-01 14:52

Also add,

<input type="hidden" name="{g->formVar var="form[options][GalleryCoreSearch][summaries]"}" value="1"/>

 
lucasmarin
lucasmarin's picture

Joined: 2010-07-14
Posts: 37
Posted: Mon, 2010-07-19 07:10

Correct me if i'm wrong, but i thing there is another way to bypass searchscan in order to show all the results.
In modules/search/SearchShowAll.inc you can replace

if (isset($form['action']['scan'])) {
$results['delegate']['view'] = 'search.SearchScan';
} else {
$results['delegate']['view'] = 'search.SearchShowAll';
}

for just

$results['delegate']['view'] = 'search.SearchShowAll';

It worked for me.

http://www.lucasmarin.com