Gossamer Forum
Home : Products : DBMan : Installation :

Choosing either/or match / fixing up the output HTML

Quote Reply
Choosing either/or match / fixing up the output HTML
I would like to have a user search one word, (i.e.; bistro), and find a record that might have several words in that field including the one they selected (drop down) (i.e.; french, bistro, asian) in the database. Is that possible or must it be an exact match?

Right now, I'm searching my database (by just one drop down box) and it won't bring up the one or two records I know exist with that "category".

Also, I'd like to edit the ouptput html page that comes up after a search with the information. The "results" are still pretty much in the "auto-generated" form all in one line in a box and I've only been able to change the BGColor so far. I'd like to may break up the layout so it's

Row 1: here Row 2: here
Row 3: here Row 4: here etc.

and put some pictures around the form. Where is the code for the output of a search and where should I start.

Hope these questions aren't too scattered. I'm extremely excited I've got it to work as much as I have!

Thanks!

www.bestweb.net/~cyborgny/tob/cgi-bin/dbman/default.cfg
Quote Reply
Re: Choosing either/or match / fixing up the output HTML In reply to
I went to your site and tried the search. All of the options in the drop-down gave me results, except for "Bistro" and "Spanish." Then I did a little snooping and accessed your database directly. The word "Bistro" only appears in the titles of two of your records. It does not appear in the "cuisine" field at all. There are also no records which have "Spanish" in the cuisine field.

As for your output, if you want to make changes to the overall look of the pages, edit the html_page_top subroutine. (I also snooped and found that you are using the "user-friendly" html.pl mod.) If you are going to use a background image (or any image, for that matter), be sure to use the full URL to the image file. Play around with the formatting in the html_page_top subroutine until you get what you want.

You can change just about everything in the subroutine. Just make sure that you start with

&html_print_headers;
print qq|

and end with

|;
}

Everything from "print qq|" to "|;" will be printed on your web page.

If you want the page titles on the pages, leave in the variables -- $html_title and $page_title

Probably the easiest way to do this is to create an html file that looks the way you want the pages to look. Use $html_title wherever you want Taste of Brooklyn to appear and $page_title wherever you want the title of the page to appear. Make a table in the center of the page, with nothing in it. (You might want to put the word, "Table" in it or something, just so you can see what you're doing.) Make sure to add in the Gossamer Threads logo and your "BACK TO SEARCH" link. One other thing. Be sure that you do not use a | character on your page.

Once you get the generic page made up, copy the top part of the page, up to (but not including) the <table> tag for your blank table. Paste that top part of your html page into the html_page_top subroutine, between print qq| and |;.

Then go back to your generic page, and start copying just after the </table> tag for your blank table. Copy all the way to the bottom of the file, including the closing </body></html> tags. Go once more to the html.pl file and paste this last code into sub html_page_bottom, between print qq| and |;.

Then take a look at it. See what you think. Make adjustments.

As for the displaying in rows, I'll need a little more information about what you want to do before I can answer you. The above should keep you busy for a little while, though. Smile

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





Quote Reply
Re: Choosing either/or match / fixing up the output HTML In reply to
Thank you very much. I see what you mean about certain categories not being in the drop down menu. I guess that's part of my problem. How would one make a searchable field where you could match ANY of the words in that field. For instance, (since you know what my site is about now), Cuisine could include 2 or more different types, so perhaps a drop-down is not the best solution? I would like to put in, French, bistro etc. and if the user only selects bistro ALL that have that in the cuisine types will come up. Checkbox? Radio Button?

I played with the Html subroutin and it worked fine. Is there a reason I wouldn't want to use the "urser_friendly" html.lp mod?

Thanks again for your help as you can see I've come along way in two weeks when I couldn't even load the demo?
Quote Reply
Re: Choosing either/or match / fixing up the output HTML In reply to
The categories *are* in the drop-down menu. They're just not in the database. No matter how you do it, if you search for something that isn't there, you won't get any results.

The way you're doing it is fine. Just add the "bistro" and "spanish" to a couple of appropriate records and you'll be covered.

No, there's no reason at all not to use the user-friendly html.pl mod. The only reason I mentioned it is that I referred to a couple of subroutines that are in that mod, but not in the script that comes with DBMan. I didn't want other people to be confused when they tried to find them.

Yep. You have come a long way. That's nice to see. Smile


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





Quote Reply
Re: Choosing either/or match / fixing up the output HTML In reply to
I've changed the subroutine for html_page_top, and now the "header" is running into my search result table. What did I do ?? Ooops!

Also, I wanted to change my search output so the result doesn't come up in one long column (and possibly no boxes around each field. For instance:

Column 1 Column 2

Name Decor
Address Credit Cards?
Phone Alcohol?

Guess I'm not sure how to modify the "autogenerated form at such an internal level (like the unsigned band pages).

Thanks!

------------------
Catalyst for the new millenium
Quote Reply
Re: Choosing either/or match / fixing up the output HTML In reply to
You need to do some html work on your html_page_top subroutine.

Between

<table border=0 bgcolor="#FFFFFF" cellpadding="0" cellspacing="3" width="500" align=right VALIGN="top">

and

<td colspan=2 bgcolor="$77bfc7">

you need to add a <tr> tag.

Between

<td align="right" valign="top"><p><center><$font_title><b>$page_title</b></font></center><br>

and

<TD WIDTH="82" BGCOLOR="#1535ff">

you need to add a </td> tag.

That should probably fix things up pretty well.

As for your search output, you'll need to create your own html_record subroutine and turn off the autogenerate feature in order to do what you want.

Again, the best way to do this is to create a "dummy" record and create an html page. (I use a freeware editor called AOLPress. Not fancy, but it does the trick.)

Make a table to look the way you want it to, with all the labels and columns you want. Instead of data, use
$rec{'FieldName'}
in each field. Be sure you keep the same spelling of the field names as you have in your database definition, including the case of the letters. "Category" is not the same as "category."

Once you get the table looking the way you want to, paste the whole table into sub html_record, between the print qq| and |; lines.

If you want to keep the autogenerate feature for your form, but not for your display, delete the following line from html_record

($db_auto_generate and print &build_html_record(%rec) and return);

Be sure not to delete the line

my (%rec) = @_;


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





Quote Reply
Re: Choosing either/or match / fixing up the output HTML In reply to
I've changed the subroutine for html_page_top, and now the "header" is running into my search result table. What did I do ?? Ooops!

Also, I wanted to change my search output so the result doesn't come up in one long column (and possibly no boxes around each field. For instance:

Column 1 Column 2

Name Decor
Address Credit Cards?
Phone Alcohol?

Guess I'm not sure how to modify the "autogenerated form at such an internal level (like the unsigned band pages).

Thanks!

------------------
Catalyst for the new millenium
Quote Reply
Re: Choosing either/or match / fixing up the output HTML In reply to
I'm confused about why you posted the same message twice. Was it an error? Or were my answers not sufficient?


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





Quote Reply
Re: Choosing either/or match / fixing up the output HTML In reply to
So, sorry. It was a BIG accidente!

THanks. Everything you said worked like gold.