Gossamer Forum
Home : Products : DBMan : Discussions :

Customizing Trouble. (Search/View)

Quote Reply
Customizing Trouble. (Search/View)
Okay, im no stranger here anymore, but my handicap is well documented LOL on these forums.

At last Dbman is running exactly the way id like it to. Im now in the process of giving it a facial treatment to take it that next step.

My problem is this.

a user decides to search for profiles.. in which case my
--------------------------------------------------------
db=default&uid=default&view_search=1 page comes up (note default user). This is fine.

A user specifies his search requirements and searches
------------------------------------------------------
my short view results page shows up. This normally consists of an ending

print qq|<p> </p>
</td>
<td align="left" valign="top" width="162"><img src="/home/database/info2.gif" width="162" height="403"></td>
</tr>
</table>
<table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" align="left" valign="top"> <img src="/home/database/edge.gif" width="1" height="1" border="0"></td>
</tr>
</table>

which is specified at the end of "html_view_success" subroutine in html.pl.

note ...this is absolutely fine !!!! and page comes up exactly how id like it too.

HERES THE PROB...

when a user clicks on the link (Name of profile) from the short list, the user is taken to the profile page for that profile clicked on from short list. Mostly this page appears fine... EXCEPT..

that the
print qq|<p> </p>
</td>
<td align="left" valign="top" width="162"><img src="/home/database/info2.gif" width="162" height="403"></td>
</tr>
</table>
<table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" align="left" valign="top"> <img src="/home/database/edge.gif" width="1" height="1" border="0"></td>
</tr>
</table>

code is included on this page which results in a table containing information i dont want on the full profile page. (info.gif) is a info pic which is only relevant to the short list page.

So.. my question is... how do i make the "html_view_succes" subroutine only print the html code above for the short list page... but print something totally different for the long results page?

THE EXTRA BIT OF CODE IS DIRRECTLY ATTRIBUTABLE TO THE CODE AT THE END OF "html_view_success", as in the subroutine.. shown below.....

sub html_view_success {
# --------------------------------------------------------
# This page displays the results of a successful search.
# You can use the following variables when displaying your
# results:
#
# $numhits - the number of hits in this batch of results.
# $maxhits - the max number of hits displayed.
# $db_total_hits - the total number of hits.
# $db_next_hits - html for displaying the next set of results.
#

my (@hits) = @_;
my ($numhits) = ($#hits+1) / ($#db_cols+1);
my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits);
$in{'nh'} ? ($nh = $in{'nh'}) : ($nh = 1);


&html_print_headers;

&page_top_search;

print qq|<table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" width="38" bgcolor="#FFFFCC"><img src="/home/database/sdp6.gif" width="38" height="63"></td>
<td width="85" align="left" valign="top"></td>
<td width="490" align="left" valign="top">

|;

if (($db_total_hits == 1) or ($maxhits == 1)) {
&html_record_long(&array_to_hash(0, @hits));
}
else {
print qq|<table width="490" border="0" cellspacing="0" cellpadding="0">
<tr align="left" valign="top">
<td><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Search
Results

</font></b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">There
are <b><font color="#FF9900">$db_total_hits</font> </b>matches. (For a new search <a href="http://www.____.com/home/database/match/db.cgi?db=default&uid=default&view_search=1">Click Here</a>)</font></td>
</tr>
</table>


<table width="460" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#000000" align="left">
<td height="1"><img src="line.gif" width="1" height="1"></td>
</tr>
<tr bgcolor="#FFFF00" align="left" valign="top">
<td> <table width="460" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="200"><font size="2"><b><font face="Verdana, Arial, Helvetica, sans-serif">
Name</font></b></font></td>
<td width="30" align="center"><font size="2"><b><font face="Verdana, Arial, Helvetica, sans-serif">Age</font></b></font></td>
<td width="30"> </td>
<td width="100"><font size="2"><b><font face="Verdana, Arial, Helvetica, sans-serif">Country</font></b></font></td>
<td width="50" align="center"><font size="2"><b><font face="Verdana, Arial, Helvetica, sans-serif">Sex</font></b></font></td>
<td width="50" align="right"><font size="2"><b><font face="Verdana, Arial, Helvetica, sans-serif">Pic </font></b></font></td>
</tr>
</table></td>
</tr>
<tr bgcolor="#000000">
<td height="1"><img src="line.gif" width="1" height="1"></td>
</tr>
</table>
|;




# <p><$font>Your search returned <b>$db_total_hits</b> matches. </font>
# if ($db_next_hits) { print "
<font face="Verdana, Arial, Helvetica, sans-serif"><font color="#000000">Pages: </font><font color="#FF9900">$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 qq|<p align=right><b><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif">Pages: <font color="#FF9900">$db_next_hits</font></font></font></b></p>|;}
}

print qq|<p> </p>
</td>
<td align="left" valign="top" width="162"><img src="/home/database/info2.gif" width="162" height="403"></td>
</tr>
</table>
<table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" align="left" valign="top"> <img src="/home/database/edge.gif" width="1" height="1" border="0"></td>
</tr>
</table>
|;

&page_bottom_search;
}

PLEASE any help welcome and appreciated



Quote Reply
Re: Customizing Trouble. (Search/View) In reply to
Ok, after reading and re-reading your post several times, I think I fianally get it Smile

Here is the problem as I understand it:
When the short view is displayed, you want the table with info2.gif etc... in it to be displayed.

When you're only looking at one record, however, you don't want that same table/graphic displayed.

Am I close? Smile

If that's the case, here's what you have to do:

in sub html_view_success, your code reads:

sub html_view_success {
# --------------------------------------------------------
# This page displays the results of a successful search.
# You can use the following variables when displaying your
# results:
#
# $numhits - the number of hits in this batch of results.
# $maxhits - the max number of hits displayed.
# $db_total_hits - the total number of hits.
# $db_next_hits - html for displaying the next set of results.
#

my (@hits) = @_;
my ($numhits) = ($#hits+1) / ($#db_cols+1);
my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits);
$in{'nh'} ? ($nh = $in{'nh'}) : ($nh = 1);


&html_print_headers;

&page_top_search;

print qq|<table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" width="38" bgcolor="#FFFFCC"><img src="/home/database/sdp6.gif" width="38" height="63"></td>
<td width="85" align="left" valign="top"></td>
<td width="490" align="left" valign="top">

|;

if (($db_total_hits == 1) or ($maxhits == 1)) {
&html_record_long(&array_to_hash(0, @hits));
}
else {
print qq|<table width="490" border="0" cellspacing="0" cellpadding="0">
<tr align="left" valign="top">
<td><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Search
Results

</font></b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">There
are <b><font color="#FF9900">$db_total_hits</font> </b>matches. (For a new search <a href="http://www.____.com/home/database/match/db.cgi?db=default&uid=default&view_search=1">Click Here</a>)</font></td>
</tr>
</table>


<table width="460" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#000000" align="left">
<td height="1"><img src="line.gif" width="1" height="1"></td>
</tr>
<tr bgcolor="#FFFF00" align="left" valign="top">
<td> <table width="460" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="200"><font size="2"><b><font face="Verdana, Arial, Helvetica, sans-serif">
Name</font></b></font></td>
<td width="30" align="center"><font size="2"><b><font face="Verdana, Arial, Helvetica, sans-serif">Age</font></b></font></td>
<td width="30"> </td>
<td width="100"><font size="2"><b><font face="Verdana, Arial, Helvetica, sans-serif">Country</font></b></font></td>
<td width="50" align="center"><font size="2"><b><font face="Verdana, Arial, Helvetica, sans-serif">Sex</font></b></font></td>
<td width="50" align="right"><font size="2"><b><font face="Verdana, Arial, Helvetica, sans-serif">Pic </font></b></font></td>
</tr>
</table></td>
</tr>
<tr bgcolor="#000000">
<td height="1"><img src="line.gif" width="1" height="1"></td>
</tr>
</table>
|;




# <p><$font>Your search returned <b>$db_total_hits</b> matches. </font>
# if ($db_next_hits) { print "
<font face="Verdana, Arial, Helvetica, sans-serif"><font color="#000000">Pages: </font><font color="#FF9900">$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 qq|<p align=right><b><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif">Pages: <font color="#FF9900">$db_next_hits</font></font></font></b></p>|;}
} <--- You have to move this

print qq|<p> </p>
</td>
<td align="left" valign="top" width="162"><img src="/home/database/info2.gif" width="162" height="403"></td>
</tr>
</table>
<table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" align="left" valign="top"> <img src="/home/database/edge.gif" width="1" height="1" border="0"></td>
</tr>
</table>
|;

&page_bottom_search;
}


All you have to do is move the green bracket:

sub html_view_success {
# --------------------------------------------------------
# This page displays the results of a successful search.
# You can use the following variables when displaying your
# results:
#
# $numhits - the number of hits in this batch of results.
# $maxhits - the max number of hits displayed.
# $db_total_hits - the total number of hits.
# $db_next_hits - html for displaying the next set of results.
#

my (@hits) = @_;
my ($numhits) = ($#hits+1) / ($#db_cols+1);
my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits);
$in{'nh'} ? ($nh = $in{'nh'}) : ($nh = 1);


&html_print_headers;

&page_top_search;

print qq|<table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" width="38" bgcolor="#FFFFCC"><img src="/home/database/sdp6.gif" width="38" height="63"></td>
<td width="85" align="left" valign="top"></td>
<td width="490" align="left" valign="top">

|;

if (($db_total_hits == 1) or ($maxhits == 1)) {
&html_record_long(&array_to_hash(0, @hits));
}
else {
print qq|<table width="490" border="0" cellspacing="0" cellpadding="0">
<tr align="left" valign="top">
<td><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Search
Results

</font></b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">There
are <b><font color="#FF9900">$db_total_hits</font> </b>matches. (For a new search <a href="http://www.____.com/home/database/match/db.cgi?db=default&uid=default&view_search=1">Click Here</a>)</font></td>
</tr>
</table>


<table width="460" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#000000" align="left">
<td height="1"><img src="line.gif" width="1" height="1"></td>
</tr>
<tr bgcolor="#FFFF00" align="left" valign="top">
<td> <table width="460" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="200"><font size="2"><b><font face="Verdana, Arial, Helvetica, sans-serif">
Name</font></b></font></td>
<td width="30" align="center"><font size="2"><b><font face="Verdana, Arial, Helvetica, sans-serif">Age</font></b></font></td>
<td width="30"> </td>
<td width="100"><font size="2"><b><font face="Verdana, Arial, Helvetica, sans-serif">Country</font></b></font></td>
<td width="50" align="center"><font size="2"><b><font face="Verdana, Arial, Helvetica, sans-serif">Sex</font></b></font></td>
<td width="50" align="right"><font size="2"><b><font face="Verdana, Arial, Helvetica, sans-serif">Pic </font></b></font></td>
</tr>
</table></td>
</tr>
<tr bgcolor="#000000">
<td height="1"><img src="line.gif" width="1" height="1"></td>
</tr>
</table>
|;




# <p><$font>Your search returned <b>$db_total_hits</b> matches. </font>
# if ($db_next_hits) { print "
<font face="Verdana, Arial, Helvetica, sans-serif"><font color="#000000">Pages: </font><font color="#FF9900">$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 qq|<p align=right><b><font size="2"><font face="Verdana, Arial, Helvetica, sans-serif">Pages: <font color="#FF9900">$db_next_hits</font></font></font></b></p>|;}

print qq|<p> </p>
</td>
<td align="left" valign="top" width="162"><img src="/home/database/info2.gif" width="162" height="403"></td>
</tr>
</table>
<table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" align="left" valign="top"> <img src="/home/database/edge.gif" width="1" height="1" border="0"></td>
</tr>
</table>
|;
} <--- Here it is

&page_bottom_search;
}


Hope this helped Smile

- Mark

Astro-Boy!!
http://www.zip.com.au/~astroboy/