Gossamer Forum
Home : Products : DBMan : Customization :

Short and long display for tempaltes?

Quote Reply
Short and long display for tempaltes?
Hi,

Has anyone done this? I tried duplicating the sub html_record with a different name sub html_record_long (in dbm_templates.pl) and created another template. html_record_long.html

now I am passing the long_url in sub html_record
as $db_script_link_url&view_records=1&$db_key=$rec{'ID'}

Firstly, I am not sure if that is correct.
Secondly, what do I need to do load the other template (html_record_long.html)?

Has anyone done this?

Thanks.
Quote Reply
Re: Short and long display for tempaltes? In reply to
If you want to have other views of records, then you can follow these steps:

1) Add the following codes to elsif statements in the db.cgi file:

Code:
elsif ($in{'detail_view'}) { if ($per_view) { &html_detail_view; } else { &html_unauth; } }

2) Then change html_record_long.html to sub html_detail_view.

3) To link to this type of layout, use the following link:

Code:
<a href="$db_script_link_url&ww=on&$db_key=$rec
{$db_key}&detail_view=1">

Hope this helps.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited October 12, 1999).]
Quote Reply
Re: Short and long display for tempaltes? In reply to
Eliot,

Thank you for your reply. However, I am having problems.

Here is what I did:

1. Added,

####### mod for short and long display
elsif ($in{'detail_view'}) { if ($per_view) { &html_detail_view; } else { &html_unauth; } }
####### end mod

Below

elsif ($in{'view_records'}) { if ($per_view) { &view_records; } else { &html_unauth; } }

in sub main, in db.cgi

Question: Am I supposed to add the above code anywhere else in db.cgi?

2. Created a new sub in templates.pl

sub html_detail_view { #done
# --------------------------------------------------------
# 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.
my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);

my $font_color = 'Font face="arial" Size=-1';
my $font = 'Font face="arial" Size=-1';

$html_record_data = &load_template ('html_detail_view.html', {
permissions => $permissions,
html_header => $html_header,
html_footer => $html_footer,
font_title => $font_title,
html_title => $html_title,
db_script_url => $db_script_url,
db_setup => $db_setup,
db_uid => $db_uid,
db_userid => $db_userid,
in_userid => $in{'userid'},
in_pw => $in{'pw'},
%rec,
%globals
});

return ($html_record_data);

}

3. Passed a detalied-url in sub html-rcord

detailed_url => "$db_script_link_url&ww=on&$db_key=$rec{$db_key}&detail_view=1",

QUESTION: $db_script_link_url&ww=on
-OR-
$db_script_link_url&www=on

4. created a link in html_record.html

<A HREF="<%detailed_url%>">more...</A>

5. When I click on the link more for each record I get a 500 error for db.cgi.

Appreciate your feedback.
Quote Reply
Re: Short and long display for tempaltes? In reply to
Oops...Sorry, socrates...I forgot that you use the Templated Version of DBMAN.

Here is what you can try using for the detailed_url variable:

Add these codes to the top of the sub html_detail_view routine in templates.pl (under the my $font stuff) file:

Code:
$detailed_url = 'a href="db_script_link_url&ww=on&$db_key=$rec{$db_key}&detail_view=1'";

Then in the "global variable" section of the
sub html_detail_view , put the following codes:

Code:
detailed_url => $detailed_url,

That should work...I hope.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Short and long display for tempaltes? In reply to
Eliot,

Still does not work. I think it is a problem with either the sub html_detail_view (above) or in db.cgi. I had already tried passing the detailed_url in both sub html_record and html_detail.

I am able to see short records. If I click on the more link I get a 500 server error for db.cgi

This is what is passed as the detailed url:
db=default&uid=guest.93983746572186&ww=on&ID=16&detail_view=1

(that is for record 16)

Any clues, what may be wrong?

Thanks

[This message has been edited by socrates (edited October 13, 1999).]
Quote Reply
Re: Short and long display for tempaltes? In reply to
Okay....

Here is the answer to your previous question, which I inadvertantly missed:

Quote:
QUESTION: $db_script_link_url&ww=on
-OR-
$db_script_link_url&www=on

ww = whole words (not world wide)

It means that it will take the whole words of the search string and provide results.

Wink

I really don't know what the problem could be. I am just now starting to play around with the Templated Version and there are some kinks in it. But TimRyan is the best person to answer this problem since he wrote the templated version.

Sorry.

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Short and long display for tempaltes? In reply to
Eliot,

Thanks for your help. I think Tim is on vacation. I will contact him, if he does not see this thread.
Quote Reply
Re: Short and long display for tempaltes? In reply to
Getting the long/short display mod is one of the last things that I need to do on my templated DBman as well. I've been fiddling around with it as you have but I still can't get it. I was actually going to post today to see if anyone else has tried it but you beat me to it. If you figure out how to do it, please let me know!!! Thanks a TON!!

------------------
Jason
Extreme mtb
http://extreme.nas.net
Quote Reply
Re: Short and long display for tempaltes? In reply to
OK, here is what you do:

But first let me say this. I may not be able to reply to problems if any, as my knowledge of programming/perl is limited. I just downloaded DBMan a couple of days ago and don't know much about it. So, rule # 1 - backup your files and data.

1. In db.cgi

(a) in sub main add this


####### mod for long display
elsif ($in{'view_record_details'}) { if ($per_view) { &view_record_details; } else { &html_unauth; } }
####### end mod

(b) add the following below, sub view_records

sub view_record_details {
# --------------------------------------------------------
# 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_detailed(@hits);
}
else {
&html_view_failure($status);
}
}


2. Now in dbm_templates_html_pl

(a) add this line in sub html_record


detailed_url => "$db_script_link_url&ww=on&view_record_details=1&$db_key=$rec{$db_key}",

(b) add the following sub below the above sub

sub html_record_details { #done
# --------------------------------------------------------
# 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.
my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);

my $font_color = 'Font face="arial" Size=-1';
my $font = 'Font face="arial" Size=-1';

$html_record_data = &load_template ('html_record_details.html', {
permissions => $permissions,
html_header => $html_header,
html_footer => $html_footer,
font_title => $font_title,
html_title => $html_title,
db_script_url => $db_script_url,
db_setup => $db_setup,
db_uid => $db_uid,
db_userid => $db_userid,
in_userid => $in{'userid'},
in_pw => $in{'pw'},
%rec,
%globals
});

return ($html_record_data);

}

(c). Copy the sub html_view_success and paste below the above sub and then name it as
sub html_view_success_detailed

(d). Find this line

$view_success_N_html_record .= &html_record (&array_to_hash($_, @hits));

and replace it with

$view_success_N_html_record .= &html_record_details (&array_to_hash($_, @hits));


4. Create a duplicate of templates

(a). view_success.html and name it view_success_details.html

(b). html_record.html and name it html_record_details.html (this is your long format and so adjust your html output here)

(c). go back to html_record.html and leave only the necessary info for short format display and then delete the rest.

(d). add this line in html_record.html anywhere <A HREF="<%detailed_url%>">Record Details</A>

That should be it, let me know if you have any problems and whether or not it worked.

jdulberg,
Your site looks nice. I was looking for your implementation of DBMan, but could not find it.


[This message has been edited by socrates (edited October 14, 1999).]
Quote Reply
Re: Short and long display for tempaltes? In reply to
I went through your instructions a couple times and got it to "almost" work. The problem is that when the view_success_details comes up, it just outputs the stuff before the <A HREF="<%detailed_url%>">Record Details</A> tag. So it looks like:

(note: this is...)

(note: this is...)

etc. etc.

It repeats itself for the # of records that are supposed to show up.

Any ideas?

I have the database running offline right now (that's why you couldn't find it on the site) but if you need to see any of my files, let me know and I'll upload 'em.

Thanks!!

------------------
Jason
Extreme mtb
extreme.nas.net

[This message has been edited by jdulberg (edited October 15, 1999).]
Quote Reply
Re: Short and long display for tempaltes? In reply to
Hi Jdulberg,

Quote:
when the view_success_details comes up, it just outputs the stuff
before the <A HREF="<%detailed_url%>">Record Details</A> tag. So it looks
like:

What do you mean by "when view_success_details comes up? The link "Record Details" should be in html_record.html and when you list all, under each short record, this link should be listed.

Now, when you click on "Record Details", depending upon what you have in the html_record_details, it should only print the info for one record.

Try everything with "default download" of DBMan and the default database.

I am not sure what "note this is.." means and where it is coming from. Can you elaborate?

This is what I have in my success_details.html template

<p><%view_success_N_html_record%><p>


Try again, if it does not work I will see if I missed anything in my instructions.
Quote Reply
Re: Short and long display for tempaltes? In reply to
The template files that I'm using came with a little blurb at the top with something like "Note: this is the html_record template" etc. I left this stuff in for trouble shooting.

I just figured out how to fix the problem that I was having. It was my fault. I added a "_detailed" to the non-detailed view success and had an IF statement which caused the stuff below it not to show up.

Looks like I have another problem now. When I click list all, it gives me all of the stuff however the "record details" link is all messed up. Instead of having something like:

...db.cgi?db=default&uid=admin.94013057765339&ww=on&view_record_details=1&ID=185

its like this...

...db.cgi?db=default&uid=admin.94013057765339&ww=on&view_record_details=1&ID=<B>0</B><B></B>

I have no idea why its adding the bold tags to the list all link and not the normal category links that I'm using. I had a look through all of the templates/cgi files for <b> tags that weren't closed and there are no errors. So basically, changing categoryies using links works fine but when doing a "list all" it all gets messed up. Any ideas? I suppose this doesn't really have much to do with the long/short display but I thought I might ask anyways.

Thanks!!

------------------
Jason
Extreme mtb
http://extreme.nas.net
Quote Reply
Re: Short and long display for tempaltes? In reply to
You need to add the following codes in the template.pl file in the sub-routine where you are linking the detailed records from:

Code:
$rec{'$db_key'} =~ s/<?.B>//g;

Hope this helps.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Short and long display for tempaltes? In reply to
Okay, now I feel like an idiot. Turns out, all I needed to do was set $db_bold = 0; in the cfg file. I just remembered it saying to do that in the original long/short display mod. Eliot, does that snippet of code allow me to set bolding to 1?

------------------
Jason
Extreme mtb
http://extreme.nas.net