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)?
Posts: 7994
Edit modules/search/templates/SearchSystemContent.tpl. Read the instructions at the top of the file to make a local copy first.
Replace this block:
with this:
Then when you search from the sidebar it'll take you right to the advanced search.
Posts: 84
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.
Posts: 7994
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.
Posts: 40
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
Posts: 16504
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
Posts: 8601
SearchBlock.tpl is the file now, as nivekiam suggests. probably the same changes would still work.
Posts: 344
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?
Posts: 16
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
Posts: 2
The following code works well in gallery 2.2.5
in SearchBlock.tpl
REPLACE:
WITH:
Posts: 6
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"/>
Posts: 32
Also add,
<input type="hidden" name="{g->formVar var="form[options][GalleryCoreSearch][summaries]"}" value="1"/>
Posts: 37
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