Gossamer Forum
Home : Products : DBMan : Customization :

Well ... doesn't hurt to ask ...

Quote Reply
Well ... doesn't hurt to ask ...
As I'm running a database of alumni names, I wonder if the pages can be viewed by A-Z -v- Page #s 1-15?

... doesn't hurt to ask ... further, I'm not really sure what search criteria I would use to find something like this, :-0.

JR

------------------
Joebagodonuts, JR or Anita
http://home.flash.net/~murgnam/
Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
Yep...Codes for this have been provided before.

Search for "Alphabetical listing".

I have this working in two web sites:

vlib.anthrotech.com
www.coco.cc.az.us/cgi-bin/directory/index.cgi?db=default&uid=default

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
THANK YOU Eliot,

With yr hint I found http://www.gossamer-threads.com/...m12/HTML/001234.html which I think gets me where I want to be ... question tho' ...

JPD says,
Code:
... else {
print qq|<p><$font>Your search returned <b>$db_total_hits</b> matches.</font>|;
if ($db_next_hits) { print "<br><$font>Pages: $db_next_hits</font>"; }
$i = 1;
print "<table>";
for (0 .. $numhits - 1) {
print "<tr>";
&html_record (&array_to_hash($_, @hits));
print "</tr>";
++$i;
}
print "</table>";
if ($db_next_hits) { print "<br><$font>Pages: $db_next_hits</font>";}
}
&html_footer;
&html_page_bottom;

... but the question is do I somehow replace or further add JPD's code?

JR
Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
Ummmm. I'm not sure I understand what you want to do.

The code you posted does a search of all records that start with a given letter. In your search results, are you wanting to use this instead of the page numbers, so it will use the search criteria as well as the alphabet?


------------------
JPD






Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
JPD,
uh...yes, I think ...
Other words, instead of my alumni having to click thru pages 1-20 to find the M's, I'd like them to simply click on M. As it is right now, ever'thin in List All is sorted by Last Name, it's the "Pages" link top/bottom I want to change to coincide with the Alpha sort ... so, yes to yr question?
JR
Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
It would require passing all of the search terms to the link. That wouldn't be a problem for the first time they click on the link, but it would be if they went to another letter after the first one.

For example, if I did a search and I wanted to see the "M" people, I could click on an "M" link. But if, from there, I wanted to see the "H" people, I would have a serious problem.

Another problem is that there would be a likelihood that some of the links would result in no matching records. I don't know how you would fix that.

Your best bet would be to add the links to the start of the search page so that people have a choice to search by the first initial of the last name (using the links) or doing a search. You would also probably want to add them to sub html_home -- and maybe eliminate the "List All" link completely.


------------------
JPD






Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
Point made. It's not earth shattering that it be done right now ... let me ponder and play at my dummy site, then come back to this.
Thx for the response.
JR
Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
Another idea would be to add 26 HTML links to your html.pl above where the page numbering is done.

Each link would do an alphabetical search by the last name. Of course, if there no matches you'll want to have your html_view_failure say there's no names under that description (something generic will do).

Then you'd leave your page numbers in, in case there are like 80 names starting with 'S' or something, they can page through them.

Just an idea. Smile

--Lee
Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
OK Ladies or Gentleman,

... still @ the pondering level, but MORE discussion here.

1. My current db has links for List All (&sb=4) and List by Class (&sb=2).
2. Taking from JPD, I envision replacing the List All with List by Alpha.
3. For the List by Class, I wonder whether I should make a "separate" db, so that I can display/sort on Class ... then use the relational mod to work the two db's together ... relational mod will have to be another time consumming venture, but an option I wanted to throw out.
4. So, with the above I only have List by Alpha. It's already "sorted" by Last Name, now I want to replace the 1 2 3 links with A B C using Alpha as the search criteria being passed. This brings me back to my 30 Apr post above, i.e., where do I/can I use the previously mentioned the code in html_record or view_success?
5. OK, now I link on the "short" display to get "J". I click on Joebagodonuts to get to the long record display ...

Herein, lies the rub. I'm fine, I think, with leaving the Previous/Next as they are. I would "think it obvious" that folks clicking Prev/Next would get I or L (using the above example), and if they didn't like that they could still click the footer while in the long record to get back to List by Alpa.

Conversely, could we replace the Prev/Next links (I'm assumming somewhere within the long_record) with the same A B C links mentioned above?

Further, I like Lee's idea of if there's no alumni with say "Q" as the first letter of their last name, that I encorporate a view-failure page.

OK, my pen's run out of ink here. This may all be redundant to what you said, but I just wanted to make sure "I" was on target with what you said.

Again, it doesn't hurt to ask, if I/we can do it, that's great, if not ... well, I'll just ponder some more, <g>.

JR
Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
If I'm understanding you correctly, there is no need to create any kind of relational database for what you want. The sorting is fine in one database.

I don't think I can explain why what you want to do won't work. (I've written and deleted three explanations already that were confusing even to me. Smile )

What I suggested earlier and still think is the best way to go, is to have alphabet links on the home page, each of which will do a search in the .db file for records starting with a given letter.

You could also add something in the header for each page to list out the alphabet links. But you cannot replace the page numbers that are at the top of the page within the search results.

Your "Previous" and "Next" links would result in names that started with the same letter.

Quote:
Further, I like Lee's idea of if there's no alumni with say "Q" as the first letter of their last name, that I encorporate a view-failure page.[/code]
No need. If they click that link, they'll get the view_failure page automatically.

I am always hesitant to say that something can't be done. Maybe it can. But it would take someone with a whole lot more smarts than me to figure it out.


------------------
JPD






Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
JPD,

In lieu of continually filling up FLThiak's inbox, I want to continue his Again-Alphabetical Listings www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/001234.html in my thread here.

Specifically, your response to FLThiak gets me the 26 links I was looking for, but doesn't account for those links when viewing the long record, i.e.,
Code:
# Go through each hit and convert the array to hash and send to
# html_record for printing.
if (($db_total_hits == 1) &#0124; &#0124; ($maxhits == 1)) {
&html_record_long(&array_to_hash(0, @hits));
}

else {
print qq|<p><$font>Your search for <b>$search_terms</b> returned <b>$db_total_hits</b> matches.
</font>|;

print qq|<P><CENTER>|;
$i = 65;
while ( $i < 91 ) {
print qq| <$font><A HREF="$db_script_link_url&Last Name in School=%5E|;
print chr($i);
print qq|&re=on&view_records=1">[|;
print chr($i);
print qq|]</a></font>\n|;
++$i;
}
print qq|</CENTER></P>|;

if ($db_next_hits) { print "<$font>Pages: $db_next_hits</font>"; }
$i = 1;

print "<table>";

print qq|
<tr></tr>
<tr>
<td width=25%><b><u>Last Name</u></b></td>
<td width=25%><b><u>Married Name</u></b></td>
<td width=25%><b><u>First Name (Nickname) & Spouses Name</u></b></td>
<td width=25%><b><u>Year Grad</u></b></td>
</tr>
<tr></tr>|;
for (0 .. $numhits - 1) {
print "<tr>";

unless ($j) {
print qq|
<tr bgcolor="#DEDCDC">|;
$j = 1;
}
elsif ($j == 1) {
print qq|
<tr bgcolor="#FFFFFF">|;
$j = 0;
}

&html_record(&array_to_hash($_, @hits));
print "</tr>";
++$i;
}
print "</table>";

print qq|<P><CENTER>|;
$i = 65;
while ( $i < 91 ) {
print qq| <$font><A HREF="$db_script_link_url&Last Name in School=%5E|;
print chr($i);
print qq|&re=on&view_records=1">[|;
print chr($i);
print qq|]</a></font>\n|;
++$i;
}
print qq|</CENTER></P>|;

if ($db_next_hits) { print "<$font>Pages: $db_next_hits</font>";}
}
&html_footer;
&html_page_bottom;
in my sub html_view_success, but that only gives me the 1st line as gray, the rest are not alternating, ;-0.
JR

[This message has been edited by joebagodonuts (edited May 08, 2000).]
Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
If you use the Alphabetic Display that we were talking about in the other thread, this is what will happen:

I come to your site and click on the "H" in the alphabet. The records returned from the search are all that start with the letter "H" in your database. The "Previous" and "Next" links in the long display will stay within the "H" letter, because that is what was searched for.

Regarding the alternate rows, I see where your problem is. You have two <tr> tags --

print "<tr>";

and

print qq|<tr bgcolor="#DEDCDC">|;

I think it will work if you take out

print "<tr>";

There is another way of doing this that I came up with recently, which is a lot more elegant.

At the beginning of your subroutine (or even in your .cfg file), define your row colors like

Code:
$row_color[0]="DEDCDC";
$row_color[1]="FFFFFF";

Then, instead of

Code:
print "<tr>";
unless ($j) {
print qq|
<tr bgcolor="#DEDCDC">|;
$j = 1;
}
elsif ($j == 1) {
print qq|
<tr bgcolor="#FFFFFF">|;
$j = 0;
}

use

Code:
print qq|<tr bgcolor="$row_color[$color]"|;
$color = !$color;



------------------
JPD






Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
JPD,

You are so kewl!!!

I took your
Code:
$row_color[0]="DEDCDC";$row_color[1]="FFFFFF";
and further changed to
Code:
$row_color[0]="#DEDCDC";$row_color[1]="#FFFFFF";
and put that up with the font preferences at the top of my html.pl (yea, I know it's not a font, but it fit, <g> ).

I then referenced your
Code:
print qq|
<tr bgcolor="$row_color[$color]"
</tr>|;
$color = !$color;
in both my sub html_view_success and topten routines and VOILA.

Only goes to show two sets of eyes are better than one -- me with my <tr>, you with your #, lol.

Thx again.

JR
Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
Yep. It does really help to have someone checking on me. Smile

Putting the @row_color array in the font area makes perfect sense. They just need to be someplace where they will be defined for the whole script, especially if you're going to be using it in several places.

Any chance you might want to use more than two colors? I even figured out how to do that. Smile


------------------
JPD






Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
lol. Well ... I kinda just want to relish this accomplishment for right now.

My hidden agenda is to find something simple enuff to work for that viewer using that "other" browser -- this kinda does it.

I'll go ahead and bookmark this thread, maybe go into more colors later.

Thx again.

JR
Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
Disclaimer: This reply is not intended to get into the browser wars.

JPD or whomever,

Sorry, not finished with this yet, :-0.

I was just bragging to my wife about me ... err you ... solving the alphabetical listing. I said, see, here's what it looks like in IE and here in Netscape ...... OOPS, it doesn't work in Netscape!

Here's what I've got in sub html_view_success:
Code:
print qq|<P><CENTER>|;
$i = 65;
while ( $i < 91 ) {
print qq| <$font><A HREF="$db_script_link_url&sb=4&Last Name in School=%5E|;
print chr($i);
print qq|&re=on&view_records=1">[|;
print chr($i);
print qq|]</a></font>\n|;
++$i;
}
print qq|</CENTER></P>|;
It's fine in IE, but in Netscape I get Error: Unknown Action.

Is there a quick fix?

JR
Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
JR:

This probably sounds like a stupid question but does your link actually contain empty spaces in the url?

<A HREF="$db_script_link_url&sb=4&Last Name in School=%5E

If so, I would try it like this:

<A HREF="$db_script_link_url&sb=4&Last+Name+in+School=%5E

could be it's having a hard time with the spaces in the url ??

Hope this helps Smile
Quote Reply
Re: Well ... doesn't hurt to ask ... In reply to
*Note to Self*
You bonehead, you've read about this b4!
Thx Lois, removing the spaces works like a charm.
JR