Gossamer Forum
Home : Products : DBMan : Installation :

Changing When Viewing Records

Quote Reply
Changing When Viewing Records
When viewing results in default mode, is there a way to change the title of the page so that it displays fields from the record? Let's say I want to title the following page:

A Life Less Ordinary (1997): Cameron Diaz, Ewan McGregor, Delroy Lindo, and Holly Hunter.

or:

$Title ($Year): $Name1, $Name2, $Name3, and $Name4

Is there a way to do this? Whatever I try and do, I get:
(): , , , and

Here's the record I want to change the title for: http://www.outermost.net/...w_records=1&ID=1

Thanks in advance,
Blake Kunisch
blake@outermost.net
ICQ: 7703534

My HTML.pl:
http://www.outermost.net/html_pl.txt
Quote Reply
Re: Changing When Viewing Records In reply to
I think you have to define the variables in the sub 'html_view_succes'

Gr.
------
Mart.
Quote Reply
Re: Changing When Viewing Records In reply to
I think you have to call the variables:
$rec{'Title'}, ($rec{'Year'},...etc.

Good luck.
-------
Mart.
Quote Reply
Re: Changing When Viewing Records In reply to
I also tried that, but to no avail. I think the problem is that when I call the variables to be displayed, the record hasn't been called yet so there are no variables to display which is why I get (): , , , and

Thanks,
Blake Kunisch
Quote Reply
Re: Changing When Viewing Records In reply to
Any idea how to define these in the sub html_view_success? Here's my sub html_view_success:
Code:
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);

$page_title = "Search Results";
&html_page_top;

# < -- Start page text -- >
# < -- Commented out next 4 lines to suppress following text -- >
# print qq|
# <p><$font>
# Your search returned <b>$db_total_hits</b> matches.</font>
# |;
# < -- End page text -->

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

# Go through each hit and convert the array to hash and send to
# html_record for printing.
for (0 .. $numhits - 1) {
print "<P>";
&html_record (&array_to_hash($_, @hits));
}
if ($db_next_hits) { print "<br><$font>Pages: $db_next_hits</font>"; }

&html_page_bottom;
&html_footer if ($per_admin);

}

Also while we're on this topic, how do I change the above code to only disply one entry per page. If someone searches for a review, I don't want more than one review per page. I don't care about the max number of hits, but just displaying one record per page.

Thanks again,
Blake
Quote Reply
Re: Changing When Viewing Records In reply to
Try it this way:
Code:
# |;# < -- End page text -->
if ($db_next_hits) { print "<br><$font>Pages: $db_next_hits</font>"; }
# Go through each hit and convert the array to hash and send to # html_record for printing.
print qq|
<table><tr><td>$rec{'Title'},($rec{'Year'},...</td></tr>|;

for (0 .. $numhits - 1) { print "<P>";
&html_record (&array_to_hash($_, @hits));
}
if ($db_next_hits) {
print "<br><$font>Pages: $db_next_hits</font>";
}
&html_page_bottom;
&html_footer if ($per_admin);
}
You als have to make sure, that the search result contain just one record.

[This message has been edited by mart (edited July 27, 1999).]
Quote Reply
Re: Changing When Viewing Records In reply to
mart - the code you gave me - does that answer my first question or second question? Also, you have the code alteration under the line:
# |;
# < -- End page text -->

Do I leave everything above those lines in tact as I had them before? Everything is working perfectly for me now except for the Title.

Thanks again,
Blake
Quote Reply
Re: Changing When Viewing Records In reply to
Hi,
I only put --<table><tr><td>$rec{'Title'},($rec{'Year'},...</td></tr>|;-- between your rules, before you gonna change anything, make a copy of the good working code.

I think you have to try and work on the part I gave you.
This is about your first question. The second one, I edit my last answere for your second one.
Quote Reply
Re: Changing When Viewing Records In reply to
This thread was getting too confusing - I won't ask two questions in one thread again. Anyways, I opened a new thread at:
http://www.gossamer-threads.com/...um5/HTML/001345.html
So that we can start over with a clean slate and clear understanding of what I am trying to accomplish.

Thanks to mart for trying to help me through this.

-Blake