Small Upgrade to the Searchalldefaulttab Tweak
Posted Apr 27, 2013 - 9:06 AM:
ex: I have the searchalldefaulttab tweak set to categories, so categories always show first on a search. But sometimes there may be no category match, but several link matches. In this case, the tab for link matches shows up, but the actual link listings remain hidden. It'd be nice if your default tab has no results, than listings of other types would become the new default.
I fixed that in searchallfilled.php by changing the code bit to:
// add template javascript for the new tabbing options
if (tweakisset('searchalldefaulttab')) $default = tweakvalue('searchalldefaulttab'); else $default = 'categories';
if ($numcatresults == 0) {
$extradocreadystuff .= "
$('#links').show0);
$('#categories').hide(0);
$('#comments').hide(0);
$('#members').hide(0);
$('#".$default."').hide(0);
";
} else {
$extradocreadystuff .= "
$('#links').hide(0);
$('#categories').hide(0);
$('#comments').hide(0);
$('#members').hide(0);
$('#".$default."').show(0);
";
}
But I'm sure there's a better way that would be universal for everyone, no matter what their default tab is.
Comments on Small Upgrade to the Searchalldefaulttab Tweak
Member
Usergroup: Customer
Joined: Nov 12, 2004
Total Topics: 9
Total Comments: 20
Posted Apr 27, 2013 - 9:06 AM:
ex: I have the searchalldefaulttab tweak set to categories, so categories always show first on a search. But sometimes there may be no category match, but several link matches. In this case, the tab for link matches shows up, but the actual link listings remain hidden. It'd be nice if your default tab has no results, than listings of other types would become the new default.
I fixed that in searchallfilled.php by changing the code bit to:
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Fixed search all to always default to a tab that has results in it.
Member
Usergroup: Customer
Joined: Nov 12, 2004
Total Topics: 9
Total Comments: 20
nice, thanks!