Welcome! Log In Create A New Profile

Advanced

Show Search Results for, in your title

Posted by aldo 
Show Search Results for, in your title
August 19, 2007 10:22PM
This is not exactly a mod but I think it makes your search a bit more professional, First you need to open up the search.php file and find require('header.html') and replace header.html with header.php now go into the templates directory, open up the template you want to add this to. then open up header.html and find where it says <TITLE> delete the <title> through </title> and replace it with this:
<title>
N.S.C. Reviews -
<?php if (($_GET['query']) == null)
{
echo 'Search';
}
else
{
echo 'Search results for ', $_GET['query'];
}
?>
</title>
Save and upload and rename it from header.html to header.php and it works! :-)
Tec
Re: Show Search Results for, in your title
August 19, 2007 11:42PM
Good idea! Especially if someone wants to bookmark that site.

I'm using the following alternative:
Let the file remain 'header.html' and just replace the row:

<TITLE> Sphider </TITLE>

with the following:

<title><? if ($start < '2') $start = '1'; if ($query !='') print "Sphider search engine. Your search term: '$query'. Results from page: $start"; else print "Sphider - a lightweight search engine.";?></title>

Happy coding

Tec
Re: Show Search Results for, in your title
August 20, 2007 12:13AM
Cool. Im a beginner PHP Coder so it was the best I can do. :-)
Re: Show Search Results for, in your title
December 16, 2007 06:40PM
Hello Folks,

Whilst I've been working on the admin folder files, I've been wondering
whether it may be possible to have live links generated from the statistics
tables to provide a URL list of the result pages found for both the top
search terms and the current search log. Is this possible?

Regards,
Steve (Peter_LT)
Tec
Re: Show Search Results for, in your title
December 17, 2007 12:18AM
The tables "Most popular searches" and "Search log" are both generated from Sphiders database table 'query_log'. This table only holds the values: query, time, elapsed and count of results.
So, as this table does not combine query input with any link, for the first view it seems a little bit difficult to link direct to a specific url.
On the other hand it would be easy to use the tables "Most popular searches" and / or "Search log" to initialize a new query input. So the stored search terms in table 'query_log' would present a new result page with (result) weights and links to the corresponding urls.
If you are interested in something, please have a look at "How to show Most popular searches in my index page?" [www.sphider.eu]
In that threat I think as version 2 I presented something close to your idea. If I didn't understand well your intension, please let me know.

Tec



Edited 1 time(s). Last edit at 12/17/2007 12:22AM by Tec.
Re: Show Search Results for, in your title
December 17, 2007 04:43PM
Hello Tec,

At the moment when I check the search log I'm having to copy and paste
the search term into a separate window with a search box to look at
what results were presented when the search was originally made. That's
no great shakes, but it would really enhance the useability of the
admin section of Sphider if live links to a new search window could be
made directly from the search terms list in the Statistics section.

I'm guessing that the difficulty is in Sphider determining which domain
these queries were made on, so that it can find the pages that were
presented in the results to the searcher. Whilst I'm pretty clued-up on
(X)HTML, mYSQL queries are still a bit of a fog to me. This was just a
"wish-list" thought...

With Season's Greetings

Regards,
Steve (Peter_LT)
Tec
Re: Show Search Results for, in your title
December 18, 2007 12:13AM
Hallo Steve,

Okay, understood your intention. You would like to get it directly in the admin section. Here it comes.
As I'm afraid today not all users are already using your XHTML valid admin, the following is still based on the non XML valid version of Sphiders admin.

Open .../admin/admin.php and search for:
print "<tr class=\"$class\"><td align=\"left\">".$word."</td><td> ".$weight."</td></tr>\n";
Delete that row and replace it with the following:
print "<tr class=\"$class\"><td align=\"left\"><a href=\"../search.php?query=$word&search=1\">".$word."</td><td> ".$weight."</td></tr>\n";

In the same file search for:
$date = $row[2];
$avg = number_format($row[3], 1);
print "<tr class=\"$class\"><td align=\"left\">".htmlentities($word)."</td><td align=\"center\"> ".$times."</td><td align=\"center\"> ".$avg."</td><td align=\"center\"> ".$date."</td></tr>";
Delete the last row and replace it with the following:
print "<tr class=\"$class\"><td align=\"left\"><a href=\"../search.php?query=$word&search=1\">".htmlentities($word)."</td><td align=\"center\"> ".$times."</td><td align=\"center\"> ".$avg."</td><td align=\"center\"> ".$date."</td></tr>";

In the same file search for:
$elapsed = $row[2];
$results = $row[3];
print "<tr class=\"$class\"><td align=\"left\">".htmlentities($word)."</td><td align=\"center\"> ".$results."</td><td align=\"center\"> ".$time."</td><td align=\"center\"> ".$elapsed."</td></tr>";
Delete the last row and replace it with the following:
print "<tr class=\"$class\"><td align=\"left\"><a href=\"../search.php?query=$word&search=1\">".htmlentities($word)."</td><td align=\"center\"> ".$results."</td><td align=\"center\"> ".$time."</td><td align=\"center\"> ".$elapsed."</td></tr>";

That's all. Now you will find the tables "Top keywords", "Most popular searches" and "Search log" with links to a new search window.

Happy coding

Tec
Re: Show Search Results for, in your title
December 18, 2007 02:01AM
Hello Tec,

That's excellent - many thanks!

I'll suitably amend it as I add it to the presently converted code as
it adds so much usability value.

For anyone using Tec's code above - you will need to add a closing </a>
before the </td> on all three lines of new code

Regards,
Steve (Peter_LT)



Edited 1 time(s). Last edit at 12/18/2007 04:02AM by Peter__LT.
Re: Show Search Results for, in your title
December 28, 2007 02:55AM
lol, i've been doing that script ever since i installed sphider.
Sorry, only registered users may post in this forum.

Click here to login