Is there a way to display your records side by side, not one row at a time?
Mar 20, 2000, 10:06 AM
Veteran / Moderator (3034 posts)
Mar 20, 2000, 10:06 AM
Post #3 of 13
Views: 2671
By side by side are you referring to the output of your database data within either
sub html_record { or sub html_record_long {?
You can format this html in any manner you wish. To display the information in say 2 columns you could do something like the following which is showing the contact information in one column and the company logo in another:
<TR><TD colspan=2> </TD></TR>
<TR><TD colspan=2><$font><B><A NAME=\"contact\">Contact Information:</A></B></font></TD></TR>
<TR><TD colspan=2><TABLE width=460 border=0><TR valign=top><TD width=260><$font>
Contact: $rec2{'UFirstName'} $rec2{'ULastName'} <BR>|;
if ($rec2{'UBusiness'}) { print qq|$rec2{'UBusiness'}<BR> |; }
if ($rec2{'RevealAdd'} eq "Yes") { print qq|$rec2{'UAddress'}<BR> |; }
if ($rec2{'RevealAdd'} eq "No") { print qq|<BR> |; }
print qq|
$rec2{'UCity'}, $rec2{'UState'} $rec2{'UZip'}<BR>
$rec2{'UCounty'} County<BR><BR>|;
if ($rec2{'RevealPhn'} eq "Yes") { print qq|<$font>Phone: $rec2{'UPhone'}</font><BR> |; }
if ($rec2{'RevealPhn'} eq "No") { print qq|<$font>Phone:</font><BR>|; }
if ($rec2{'UFax'}) { print qq|Fax: $rec2{'UFax'}<BR> |; }
print qq| </font></TD><TD width=200 align=center valign=top> |;
if ($rec{'RevealLogo'} eq "Yes") { print qq|<IMG SRC="$rec2{'UCoLogo'}"></A>|; }
print qq| </TD></TR></TABLE></TD></TR>
<TR><TD colspan=2> </TD></TR>
This would allow you to have the full screen width for some data and then have some information displayed in columns.
Notice the table within the table.
Hope this is what you were looking for and that it provides ideas
sub html_record { or sub html_record_long {?
You can format this html in any manner you wish. To display the information in say 2 columns you could do something like the following which is showing the contact information in one column and the company logo in another:
<TR><TD colspan=2> </TD></TR>
<TR><TD colspan=2><$font><B><A NAME=\"contact\">Contact Information:</A></B></font></TD></TR>
<TR><TD colspan=2><TABLE width=460 border=0><TR valign=top><TD width=260><$font>
Contact: $rec2{'UFirstName'} $rec2{'ULastName'} <BR>|;
if ($rec2{'UBusiness'}) { print qq|$rec2{'UBusiness'}<BR> |; }
if ($rec2{'RevealAdd'} eq "Yes") { print qq|$rec2{'UAddress'}<BR> |; }
if ($rec2{'RevealAdd'} eq "No") { print qq|<BR> |; }
print qq|
$rec2{'UCity'}, $rec2{'UState'} $rec2{'UZip'}<BR>
$rec2{'UCounty'} County<BR><BR>|;
if ($rec2{'RevealPhn'} eq "Yes") { print qq|<$font>Phone: $rec2{'UPhone'}</font><BR> |; }
if ($rec2{'RevealPhn'} eq "No") { print qq|<$font>Phone:</font><BR>|; }
if ($rec2{'UFax'}) { print qq|Fax: $rec2{'UFax'}<BR> |; }
print qq| </font></TD><TD width=200 align=center valign=top> |;
if ($rec{'RevealLogo'} eq "Yes") { print qq|<IMG SRC="$rec2{'UCoLogo'}"></A>|; }
print qq| </TD></TR></TABLE></TD></TR>
<TR><TD colspan=2> </TD></TR>
This would allow you to have the full screen width for some data and then have some information displayed in columns.
Notice the table within the table.
Hope this is what you were looking for and that it provides ideas
Mar 20, 2000, 1:00 PM
User (65 posts)
Mar 20, 2000, 1:00 PM
Post #4 of 13
Views: 2667
that does provide some great idea. I'm going to study the code more tonight, but from the looks of it, it does not look like exactly what i had in mind. I was just curious say, if i have record 1, and record 2, how to display both of them side by side. take a look at this example:
http://24.11.140.106/cgi-bin/streetracing/dss/db.cgi?db=default&uid=default&new_records=1
http://24.11.140.106/cgi-bin/streetracing/dss/db.cgi?db=default&uid=default&new_records=1
Mar 20, 2000, 1:26 PM
Veteran / Moderator (3034 posts)
Mar 20, 2000, 1:26 PM
Post #5 of 13
Views: 2657
I'm less clear on what you're looking for my checking that link
I think you may be looking for the short/long display which would give you a limited amount of information and then link to the full display of the record?
If this is still not what you are looking for, please provide a text example and try to explain in more detail of what you are trying to accomplish.
I'm sorry, but I'm still not sure what you are wanting to do if it's not the short/long display.
I think you may be looking for the short/long display which would give you a limited amount of information and then link to the full display of the record?
If this is still not what you are looking for, please provide a text example and try to explain in more detail of what you are trying to accomplish.
I'm sorry, but I'm still not sure what you are wanting to do if it's not the short/long display.
Mar 20, 2000, 8:27 PM
Veteran / Moderator (8669 posts)
Mar 20, 2000, 8:27 PM
Post #7 of 13
Views: 2672
Mar 20, 2000, 11:09 PM
User (65 posts)
Mar 20, 2000, 11:09 PM
Post #8 of 13
Views: 2678
Here you go..
sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.
# <table width="100%" border="1" cellspacing="0" cellpadding="2">
my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);
print qq|
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#000099">
<td>
<div align="center"><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">$rec{'Title'} - $rec{'Date'}</font></div>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="133"><A HREF="$rec{'URL'}"><img src="$rec{'Image'}" border=2 alt="Click Here for $rec{'Title'}"></td>
<td width="86%" bgcolor="#0000CC">
<div align="center"><font color="#000000"><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">$rec{'Description'}</font></div>
</td>
</tr>
</table>
|;
}
sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.
# <table width="100%" border="1" cellspacing="0" cellpadding="2">
my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);
print qq|
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#000099">
<td>
<div align="center"><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">$rec{'Title'} - $rec{'Date'}</font></div>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="133"><A HREF="$rec{'URL'}"><img src="$rec{'Image'}" border=2 alt="Click Here for $rec{'Title'}"></td>
<td width="86%" bgcolor="#0000CC">
<div align="center"><font color="#000000"><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">$rec{'Description'}</font></div>
</td>
</tr>
</table>
|;
}
Mar 21, 2000, 12:46 AM
Veteran / Moderator (8669 posts)
Mar 21, 2000, 12:46 AM
Post #9 of 13
Views: 2662
Mar 21, 2000, 10:47 AM
Veteran / Moderator (8669 posts)
Mar 21, 2000, 10:47 AM
Post #11 of 13
Views: 2654
Thanks, Ryan. (Sorry if I was a bit abrupt in my last post. Sometimes when I'm sleepy I get a little brusque.)
I just needed to be sure you hadn't made a lot of changes to sub html_view_success. You haven't.
In sub html_view_success, instead of:
print "<P>";
&html_record (&array_to_hash($_, @hits));
}
use
for (0 .. $numhits - 1) {
++$rec_count;
if ($rec_count%2) {
print "<tr>\n";
}
print "<td>";
&html_record (&array_to_hash($_, @hits));
print "</td>";
unless ($rec_count%2) {
print "</tr>\n";
}
}
# this section prints out a blank cell in case there are an odd number of records returned
unless ($rec_count%2) {
print "<td>&</td></tr>\n";
}
print "</table>";
------------------
JPD
I just needed to be sure you hadn't made a lot of changes to sub html_view_success. You haven't.
In sub html_view_success, instead of:
Code:
for (0 .. $numhits - 1) { print "<P>";
&html_record (&array_to_hash($_, @hits));
}
use
Code:
print "<table>"; for (0 .. $numhits - 1) {
++$rec_count;
if ($rec_count%2) {
print "<tr>\n";
}
print "<td>";
&html_record (&array_to_hash($_, @hits));
print "</td>";
unless ($rec_count%2) {
print "</tr>\n";
}
}
# this section prints out a blank cell in case there are an odd number of records returned
unless ($rec_count%2) {
print "<td>&</td></tr>\n";
}
print "</table>";
------------------
JPD