Gossamer Forum
Home : Products : DBMan : Installation :

Short, long, and extra long display

Quote Reply
Short, long, and extra long display
Hi,

Just wanted to know, can I use as many as the Short Long display method I need.?

This is what I will probably have. The first will be a very short display, i.e. Name. Then there will be a long display, i.e. Name, Last name, and Address. Then there will be an extra long display, i.e. Name, last name, Address, Occupation, Age, etc..

All i want to know is, will I be able to create as many sub_view_sucess as I want without getting in to problems.?

------------------
Thanks
JFrost

Quote Reply
Re: Short, long, and extra long display In reply to
Sure. You can have as many as you want. The problem can arise with telling DBMan which one to use.

The thing you'll want to do is set up a variable that is passed through the URL to determine which display is used. You could use something like "display=long," "display=med" and "display=short." Or you could use "long=1," "med=1," "short=1."

If you use the "display=" method, in html_view_success, you would use

Code:
for (0 .. $numhits - 1) {
print "<P>";
if ($in{'display'} eq "long") {
&html_record_long (&array_to_hash($_, @hits));
}
elsif ($in{'display'} eq "med") {
&html_record_med (&array_to_hash($_, @hits));
}
else {
&html_record_short (&array_to_hash($_, @hits));
}
}

For the "long=1," etc. method, it would be:

Code:
for (0 .. $numhits - 1) {
print "<P>";
if ($in{'long'}) {
&html_record_long (&array_to_hash($_, @hits));
}
elsif ($in{'med'}) {
&html_record_med (&array_to_hash($_, @hits));
}
else {
&html_record_short (&array_to_hash($_, @hits));
}
}

With my examples, the default is the short display, but you could make the default whichever one you wanted. (I guess you really would have to use the "display=short" or "short=1" if you had them for the default.)

Ain't this a great script? You can make it do just about anything!


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