| 11.0 |
Improving
the Search Pages. |
| 11.1 |
Open results.asp and add
a new table above the results display table with the following
attributes:
Rows 1, Columns 2, CellPad 0, CellSpace 10, Border 0.
In the first column type New Search. Click on the folder icon
to the right of the link text box in the properties palette
and browse to the search.asp page.
In the second column type Back, in the link text box of the
properties palette type #. This will make the text appear as
link without actually linking to anything - yet.
|
| 11.2 |
Has
your new table been created within the Show If behaviour? If
it has, use the
Button to change the page view to code view. And find the server
behavour:
<%
If DontDo <> 1 Then
If Not rsQryDisplayFields.EOF
Or Not rsQryDisplayFields.BOF
Then %>
Highlight the text
and drag it below the closing table HTML tag </table>
of the table we have just added.
When you return to page view
the new table should be above the Show If label.
|
| 11.3 |
Next
we are going to use a little piece of JavaScript to make our
Back link do something. Switch to code view and find the Back
text in the HTML. Alternatively try the
button to view the page and the code simultaneously. This makes
it really easy to find parts of the page in the HTML code. Click
on the Back text on the page, your cursor should appear at the
Back text in the code view.
<td
width="71%"><font
face="Arial, Helvetica, sans-serif"><b><a
href="#">Back</a></b></font></td>
Just after the sans-serif"
type the following piece of code:
onClick="history.back()"
So that your line of
code now appears as follows:
<td
width="71%"><font
face="Arial, Helvetica, sans-serif" onClick="history.back()"><b><a
href="#">Back</a></b></font></td>
Once we have created
the Table and the links we can copy the whole Table and paste
it into a similar position on the details page.
|
| 11.4 |
Next
select results.asp in the site window and press F12 to preview
the page in your default browser.
Oh dear, we get a horrible database error page, the results
page needs some input to function. Suppose a visitor to our
site chooses to bookmark the results page. When they use the
favourites link to find our site they will see the error page,
and perhaps assume that our site no longer exists.
To remedy this we are going to redirect anyone that tries to
access the results page directly to the search page.
Open the results page in code view.
Just below the line
<!--#include
file="Connections/TDSFdemoOLE.asp" -->
Type the following code:
<%
If Request("selGenre")
= "" Then
Response.Redirect("search.asp")
End If
%>
Save the changes and
press F12 again to preview the page. Instead of a nasty error
page we are taken to the search page. |