Gossamer Forum
Home : Products : DBMan : Customization :

Short/Long display modification..

Quote Reply
Short/Long display modification..
Im trying to display the html_record_long differently to that of the shorted listed dispay.. an example will explain better..

http://www.canarysearch.net/cgi-bin/Canarias/Property/db.cgi?db=default&user=guest&uid=default&view_records=1&sb=3&ID=*

If I click through on More Details!! a new window appears with that single record in.. The problem is that I dont want the logo or footer in on this popup page..

How can I get round this.. Thanks.. Justin

Quote Reply
Re: Short/Long display modification.. In reply to
don't call &html_footer; in your sub html_view_success ... well might not be that simple but you should get the idea. It's not that difficult. Just becareful that tables are closed off and other html NO-NOs and things should go ok. It's mostly html tags that's going on here.


Also you can even make another sub for long with out the info you don't want. It's not really complicated to do (hehe, I did it and I can't even program).

good luck



**************************************
on the pages in between ...
Quote Reply
Re: Short/Long display modification.. In reply to
Thanks Qooq for the reply..

I will go with the second options "make another sub for long" as I dont use the &html_footer anyway..

Can u tell me how you went about this and what you include this in the script.. help appreciated.. Justin

Quote Reply
Re: Short/Long display modification.. In reply to
Are you using the the long view for something else right now? If you're not why make another sub. It's not difficult to do but it does take time to track everything down and setup if statements or whatever.

could you explain what kind of output(view) flow you'd like?

good luck

**************************************
on the pages in between ...
Quote Reply
Re: Short/Long display modification.. In reply to
I think you will find a solution in the FAQ noted below in the section "Viewing".

There are various threads related to creating different viewing options.

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Short/Long display modification.. In reply to
With reference..

"could you explain what kind of output(view) flow you'd like?"

When you click through on More Details!! I need the long record to display only the results.. ie, no graphics, no Start Page.. Add Property etc.. and also not the bottom part of the page ie, All Rights Reserved..

I want Next, Previous, Back to Records List, Record 1 of 11 to be displayed, the Ref, Type, Price, Contact and the Description (below the black line) to be displayed..

This is a link to my html.pl http://www.canarysearch.net/htmlp_guest.txt

Once again.. Thanks 4 your help.. Justin

Quote Reply
Re: Short/Long display modification.. In reply to
ummm ... I'm pretty sure all you're looking for is a shortened long sub ... which would mean just cutting out unnecessary html ...

give it a shot ... if you're still not satisfied then post (only) sub html_record_long then let's see what I or somebody else can help you with.

good luck

**************************************
on the pages in between ...
Quote Reply
Re: Short/Long display modification.. In reply to
It seems to me that when you click through to the long record this bit below is where it is coming from in the sub html_view_success
------------------------
# Go through each hit and convert the array to hash and send to
# html_record for printing.
if ($maxhits == 1) {
&html_record_long(&array_to_hash(0, @hits));
}

------------------------
and as a result, what I dont want to be displayed is being displayed..

Anyway here is my html_record_long

sub html_record_long {
#----------------------------------------------------------------
my (%rec) = @_;

if ($db_total_hits > 1) {

# create links to previous and next records

$next_url = $ENV{'QUERY_STRING'};
$next_url =~ s/\&nh=\d+//;
$next_hit = $nh + 1;
$prev_hit = $nh - 1;

if ($prev_hit) {
$previous = qq~<a href="$db_script_url?$next_url&nh=$prev_hit"><$font>Previous</font></a>~;
}
else { $previous = " "; }

if ($next_hit <= $db_total_hits) {
$next = qq~<a href="$db_script_url?$next_url&nh=$next_hit"><$font>Next</font></a>~;
}
else { $next = " "; }

# create link back to short display
$list_url = $next_url;
$list_url =~ s/\&mh=\d+//;
$mh = $db_max_hits;
$lh = int(($nh-1)/$mh) + 1;
$list = qq~<a href="$db_script_url?$list_url&nh=$lh">Back to record list</a>~;

# print out the links
print qq|
<div align="center"><center>
<table border="0" width="640">
<tr>
<td><p align="left">$previous</td>
<td><p align="center"><$font>$list - Record $nh of $db_total_hits</font></td>
<td><p align="right">$next</td>
</tr>
</table>
</center></div>
|;
}

# Below is where you define your form.

# <-- Start of record display -->

my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';

print qq|


<div align="center"><center>
<table border="0" cellspacing="0" width="640" cellpadding="2">
<tr>
<td width="100%"><$fontnavy><u>Ref:</u></font>&nbsp<$font><b>$rec{'ID'}</b></font>&nbsp<$fontnavy><u>Type:</u></font>&nbsp<$font>Canarias/$rec{'Category'},&nbsp$rec{'Complex'}.</font>&nbsp<$fontnavy><u>Price:</u></font>&nbsp<$font>$rec{'Price'}&nbspEuros</font></td>
</tr>
<tr>
<td width="100%"><$fontnavy><u>Contact:</u></font>&nbsp<$font>$rec{'Contact'}</font></td>
</tr>
<tr>
<td width="100%"><hr size="1" color="#000000"></td>
</tr>
<tr>
<td width="100%"><$font>$rec{'Description'}</font></td>
</tr>
</table>
</center></div>
|;

# <-- End of record display -->

}

As you can see it does not have any additional html to cause these to be displayed..

Let me know what you think.. Thanks.. Justin

Quote Reply
Re: Short/Long display modification.. In reply to
DOH, I was an idiot this morning. hehe ... I should've mentioned sub html_view_success instead.

something like this in this sub might be the problem ::: &html_footer;

which would mean that if you don't want to erase all the footer or whatever ... I have all kinds of weird calls to html like:

&html_main_bottom;
&html_page_bottom;

you might want to consider making another sub with calls to what ever html you like. But check first if the above solution works first. I'd hate to have you all kinds of work just to find out the first way was better.

sorry to send you on the wild goose chase ... what was I thinking ... sorry


:-(



good luck

**************************************
on the pages in between ...
Quote Reply
Re: Short/Long display modification.. In reply to
Hi Qooq.. thanks for going along with me on this one..

I do want to create another sub and I do want to do what you suggested but in not sure how to go about this.. If you could show me an example I will try this out.. Thanks

Quote Reply
Re: Short/Long display modification.. In reply to
Generally speaking: You can modify html code generation depending on name/value pairs passed in the query string. For example, you can call the long display with this link:
"<a href="$db_script_url?db=$db_setup&uid=$db_uid&view_records=1&ID=*&long=1">click this link</a>"
In html_view_success, html_footer, html_record, well, wherever you print out html code, you can then use the presence of the name "long" as a condition:
if ($in{'long'}) { print some code for the long display;}
Or:
unless ($in{'long'}) {print whatever you want in other pages, and NOT in the long display;}
Whether you add conditions to already existing subs or write a new sub depends on how much of the code you want to differ. For example, I have html_page_top and html_page_bottom common to all the different databases I have, html_view_success is different for each database because I use many different page designs, and from html_view_success I call html_record when someone works on the database, and html_record_generate when database searches are called from the general "public".
Be sure to, if you write a separate sub, add a further "elsif-"-loop in sub main in db.cgi which points to the sub in html.pl:
elsif ($in{'long'}) {if ($per_view) {&html_generate_long_display;}}
Otherwise db.cgi will complain.
I hope this clarified things a bit, though being only very general ...

kellner
Quote Reply
Re: Short/Long display modification.. In reply to
OK! I see what's going on ... short answer:
move your html coding from sub html_view_success to sub html_record. that'll take care of it hopefully the easy way.

Kellner, has provided some very good insight, hehe I didn't really understand the sub main in db.cgi until what he wrote!, but he really didn't go into what to do about the the html thingy that you want.

But, Kellner did get me to look in the right area, Thanks Kellner!

here's a part of my db.cgi that might be useful ??/

sub view_records {
# --------------------------------------------------------
# This is called when a user is searching the database for
# viewing. All the work is done in query() and the routines just
# checks to see if the search was successful or not and returns
# the user to the appropriate page.

my ($status, @hits) = &query("view");
if ($status eq "ok") {

if ($in{'lookhere'} eq 'D')
{
&html_dealer_success(@hits);
}
else {
&html_view_success(@hits);
}

}
else {
&html_view_failure($status);
}
}


I have a dbman setup to be bi-lingual and has special html for dealers, the lookhere (lame variable name but IT definately will not be used by anyone else except me ...) that is set by which defaul"A/b.c"".cfg I send the user to by a link. Now after thinking about what I've done ... for your situation you could do this much easier probably by:

making another sub html_view_succes in html.pl give it a new name like sub html_view_success_record_only

goto db.cgi and change it so it reads like:

if ($status eq "ok") {
&html_view_success_record_only(@hits);
}
else {
&html_view_failure($status);
}

and in sub html_view_success_record_only use only the html you want.

to make it more complicated you could probably put some if statements in db.cgi sube view_success to call the original view_success based on some conditions that you need. Sorry ... I'm too lazy to do that for you I'd rather help then do the coding :-)

ahhh, I wasn't such an idiot as I thought, at the begining of the thread I DID mention sub view_success ... err ... I'm a scatter brain at times. Sorry :^)

good luck and let me know how it goes.


**************************************
on the pages in between ...
Quote Reply
Re: Short/Long display modification.. In reply to
Ive been on this most of the day now.. and still having noluck..

I tried both ways..

Qooq your suggestion worked and then again it didnt work.. the popup window displayed the new sub but also the same appeared in the shot listed results.. I got confused with this bit.. When I put this in the db.cgi I got errors..

sub view_records {
# --------------------------------------------------------
# This is called when a user is searching the database for
# viewing. All the work is done in query() and the routines just
# checks to see if the search was successful or not and returns
# the user to the appropriate page.

my ($status, @hits) = &query("view");
if ($status eq "ok") {
&html_view_success_record_only(@hits);
}
else {
&html_view_success(@hits);
}
else {
&html_view_failure($status);
}
}

*********************************
I tried the other suggestion by kellner, and once again made a new sub.. but I know Ive got my brackets mixed up and I receive an error.. If this does work, will it still pass on the variables and display the results in the long record..

sub html_view_success_record_only {
# --------------------------------------------------------

if ($in{'long'}) {
<html>
<head>
<div align="center"><center>

<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><hr width="85%" color="#000000">
</td>
</tr>
</table>
</center></div>
</body>
</html>}
|;
}

*******************************
Thanks Justin

Quote Reply
Re: Short/Long display modification.. In reply to
OK take a look at the flow of things:
--> you get a search --> goes to view success which sends it to sub html_record (1) or html_record_long (2+) ...

note: my idea with sub html_view_success_record_only is that this version doesn't include all the html that's in the regular html_view_success just the next hits and menu links if you want. sub html_view_success will include your html coding and can be used for the short view version.

now the problem is how does dbman differentiate between which view_success to use!!!

I'd use Kellner's advice and $long=1 on the end the detailed link, then in db.cgi under the sub view_records do the if check there.

sorry for not being a little clearer early I was in a bit of rush, again so now too, gotta go to bed, long day, I'll check back after waking up to see how this goes for you.

good luck

**************************************
on the pages in between ...