PDA


View Full Version : my ideas may be too big to do, but thoughts?


absolutepunknet
06-27-2005, 01:47 AM
I have set it up so "quicksearch" is only useable via a link (for example: http://www.absolutepunk.net/artists/search.php?do=searchresults&quicksearch=1&orderby=name&direction=ASC&string=cartel)

now, what i would like to do is set it up so that that link will pull the first found link, and go directly to the details of it..

then, my plan is to use a htaccess file to do a "quicksearch"

therefore: www.absolutepunk.net/cartel

will point to: http://www.absolutepunk.net/artists/search.php?do=searchresults&quicksearch=1&orderby=name&direction=ASC&string=cartel

which will then point to:
http://www.absolutepunk.net/artists/showlink.php?do=showdetails&l=1521&catid=searchresults&searchid=16085

And pull up the "band profile"

any ideas on how to accomplish this?

Rue
06-27-2005, 03:24 AM
Okay, do your htaccess file, and then...

In links/search.php find the following and try adding what is in bold:

if ($DB_site->num_rows($getlinks))
{
$linkcount = 0;
while ($links = $DB_site->fetch_array($getlinks))
{


if ($quicksearch == 1) {

$redirect_to = "http://www.absolutepunk.net/artists/showlink.php?do=showdetails&&catid=searchresults&l=".$links['linkid'];
exec_header_redirect($redirect_to);

}


$linkcount++;
$linkidarray[] = $links['linkid'];
}
}
else
{
eval(print_standard_error('searchnoresults'));
}

Note that the searchid, for the query string you have, looks to be only for highlighting, and besides after links/forums/includes/cron/links_search.php runs, there will no longer be an entry in the links_search table for that searchid if it was over 24 hours ago.

Alternatively, you can include the searchid if you want by instead trying the following in links/search.php:

if (!empty($linkidarray))
{


if ($quicksearch == 1) {

$links['linkid'] = $linkidarray[0];

}


$linkarray = implode(',', $linkidarray);

if (!empty($users))
{
$usernames = serialize($users);
}

$DB_site->query("INSERT INTO " . TABLE_PREFIX . "links_search (string, username, sfields, catids, dateline, userid, linkids, orderby, direction, wholeword, numresults, searchtime) VALUES ('" . addslashes(htmlspecialchars($string)) . "', '$usernames', '$fields', '$catids', '" . time() . "', '$bbuserinfo[userid]', '$linkarray', '" . addslashes(htmlspecialchars($orderby)) . "', '" . addslashes(htmlspecialchars($direction)) . "', '$_REQUEST[matchwholeword]', '$linkcount', '" . number_format(fetch_microtime_difference($starttimecounter), 3) . "')");

$searchid = $DB_site->insert_id();


if ($quicksearch == 1) {

$redirect_to = "http://www.absolutepunk.net/artists/showlink.php?do=showdetails&&catid=searchresults&l=".$links['linkid']."&searchid=".$searchid;
exec_header_redirect($redirect_to);

}


$url = 'search.php?do=searchresults&searchid=' . $searchid;
eval(print_standard_redirect('search'));
}

One final note: These changes will redirect to the first search result found, if all goes well. ;)

EDIT: Removed a couple headers from bolding as vB's exec_headers() should do them.
EDIT: Added if conditionals in bold blue, and used vB's exec_header_redirect() instead.

absolutepunknet
06-27-2005, 06:10 AM
worked.

beautiful..

however, this does the same thing doing a regular search as well..

i want it to only do this feature if i am using the "quicksearch=1" feature.

absolutepunknet
06-27-2005, 06:20 AM
... will play with it more, any ideas though?

Rue
06-27-2005, 06:43 AM
See post #2 again, it's been updated, and look for the blue. ;)

absolutepunknet
06-27-2005, 06:58 AM
brilliant.

this worked absolutely perfectly for me .. and i'm going to really improve my website because of it - thank you.

also, i edited to:

http://www.absolutepunk.net/artists/showlink.php?do=showdetails&l=".$links['linkid'];

so that it won't be effected by the "Search id" thing.

Rock3
06-16-2007, 11:38 AM
is there a way to do this with the updated version of Links Directory? The code quoted no longer exists in that file.