Gossamer Forum
Home : Products : DBMan : Customization :

<a href="$long_url"> on short/long version.

Quote Reply
<a href="$long_url"> on short/long version.
Just another question.. Its probably easier to see it in action..

http://www.canarysearch.net/cgi-bin/Flights/db.cgi?db=default&uid=default&view_records=1&ID=*

I want it when some1 clicks through on Reserve Flight it brings up that associated record and not always the first one... I need to get the ID value somewhere in <a href="$long_url">Reserve Flight!</a> so as it links to that..



# <-- Start of short display formatting -- >

print qq|
<table border="0" width="100%" cellspacing="0" cellpadding="1" align="left">
<tr>
<td width="6%"><$font>$rec{'Ref'}</$font></td>
<td width="11%"><$font>$rec{'AirportDeparture'}</$font></td>
<td width="3%"><$font>--></$font></td>
<td width="11%"><$font>$rec{'AirportDestination'}</$font></td>
<td width="8%"><$font>$rec{'DepDay'}-$rec{'DepMonth'}-$rec{'DepYear'}</$font></td>
<td width="8%"><$font>$rec{'Duration'}</$font></td>
<td width="6%"><$font>$rec{'Time'}</$font></td>
<td width="12%"><$font>$rec{'Price'}</$font></td>
<td width="15%"><$font>$rec{'TravelAgent'}</$font></td>
<td width="20%"><$font><a href="$long_url">Reserve Flight!</a>|;if($rec{'Deal'} eq 'Last Minute') {print qq| <$fontblue>Last Minute</$font> |;} elsif($rec{'Deal'} eq 'Special Offer') {print qq| <$fontred>Special Offer</font> |;}print qq|</$font></td>
</tr>
</table>
|;

Thanks..... Justin



Quote Reply
Re: <a href="$long_url"> on short/long version. In reply to
justin:

I doesn't look like you are associating a field name to the long display try something like:

<td width="20%"><$font><a href="$long_url">Reserve Flight! - $rec{'ID'}</a>

(changing ID to match the name of your ID field)


I also noticed your are using </$font> ... just using </font> should be all you need.
By using the font variable ($font ) your script is outputting:

</font face="MS Sans Serif,arial,helvetica" size="1">


Let me know if this helped Smile

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: <a href="$long_url"> on short/long version. In reply to
Thanks for pointing the </$font> thing out..

It seems as if the &nh=1 bit of the url is not increasing..

http://www.canarysearch.net/cgi-bin/Flights/db.cgi?db=default&uid=default&view_records=1&ID=*&nh=1&mh=1

Any other thoughts LoisC..

Thanks.... Justin




Quote Reply
Re: <a href="$long_url"> on short/long version. In reply to
I would check the configuration of the $long_url variable. It should look like the following:

Code:

$long_url = $db_script_link_url&ww=on&$db_key=$rec
{$db_key}&view_records=1;


This will link to the long view of the Record in your short view table.

Regards,

Eliot Lee


Quote Reply
Re: <a href="$long_url"> on short/long version. In reply to
justin:

what do you have for the configuration for the short display. did you modify the default for some reason?

It should be like the following:

# create link to full display

$record_number = ((($nh - 1) * $db_max_hits) + $i);
$long_url = $ENV{'QUERY_STRING'};
$long_url =~ s/\&nh=\d+//;
$long_url =~ s/\&mh=\d+//;
$long_url = "$db_script_url?$long_url&nh=$record_number&mh=1";

I don't know why yours is including &nh=1 in the link.
Try changing it back to the default and see if all will work correctly then.

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: <a href="$long_url"> on short/long version. In reply to
Firstly.. Thanks for your help..

I found the problem.. I started again with a fresh copy of the html.pl and copied each part of the old html.pl till it worked no more.. I found this to be the problem..

I wanted to alternate the colours of each row.. yellow/white etc..

JPDeni kindly provided the code...
http://www.gossamer-threads.com/perl/forum/showflat.pl?Cat=&Board=DBCust&Number=94101&page=3&view= collapsed&sb=5

I just needed to replace.. ++$rec_count; to ++$i;

For Example...

for (0 .. $numhits - 1) {
$color = !$color;
print qq|<tr bgcolor="$row_color[$color]">|;
&html_record (&array_to_hash($_, @hits));
print "</tr>";
++$rec_count;
}
************************
for (0 .. $numhits - 1) {
$color = !$color;
print qq|<tr bgcolor="$row_color[$color]">|;
&html_record (&array_to_hash($_, @hits));
print "</tr>";
++$i;
}

The thing is now... if there is only one record it shows the long version and not the listed one I originally wanted..

Can anyone help with this... Thanks
Quote Reply
Re: <a href="$long_url"> on short/long version. In reply to
Any ideas appreciated... Justin

Quote Reply
Re: <a href="$long_url"> on short/long version. In reply to
In Reply To:
The thing is now... if there is only one record it shows the long version and not the listed one I originally wanted..
Are you saying you want the short version even when only one record is returned from a search?

In sub html_view_success, change

if (($db_total_hits == 1) || ($maxhits == 1)) {

to

if ($maxhits == 1) {



JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: <a href="$long_url"> on short/long version. In reply to
"Better now :)" I´m glad of that and so is my DBMan.. It works good.... Thanks JPDeni and others...... Justin

Quote Reply
Re: <a href="$long_url"> on short/long version. In reply to
I changed the mods to reflect this, too.

The reason I set it up that way to start with is that I, as a user, become annoyed when there is only one thing returned from a search and I have to click on something else to be able to see it. It seemed like such a waste of time.

However, it seems that I am the only one who feels this way, so I bow to the majority. Smile

JPD
http://www.jpdeni.com/dbman/