Gossamer Forum
Home : Products : DBMan : Customization :

Viewing data from other HTML files

Quote Reply
Viewing data from other HTML files
I'm really sorry if this has been asked before but I have searched the threads. Either it is here and labeled so I can't find it or it hasn't been asked.

I understand the concept of what I want to do but just cannot figure out how to best do what I need.

What I would like to do, two things really:

1. View a list of items from dbman in an already existing html file. In my example it is the name of the group and I want them all to appear in a dropdown list so users can select the group from within the form. I'm currently donig this now but what I did was create a script inside dbman that creates an external text file and when users go to the form, it displays the txt file within .shtml file. This works but I'm sure there is an easier method. It also only works when the admin remembers to "export" the file after she has entered groups into the list.

2. In addition to the above I would like to see if it is possible to display another field from dbman, this time its the groups mission statement, on another html file. So we have the html file that already exists but I would like to popular a portion of this with a specific groups mission statement. Ideally the url would have a parameter that points to the group, example: http://www.webpage.com/...ay.html?group=sample

After typing this it now seems like I'm asking a lot - if so, I truly apologize. This forum has been very helpful to me in the past and there are a lot of knowledgeable users here. I love dbman and think its flexible to what I need....just don't know exactly how to go about doing all of this.

THANKS AGAIN, IN ADVANCE! Jon
Quote Reply
Re: [jmortimer] Viewing data from other HTML files In reply to
OK, I have been searching and realized that the term I should be using is SSI (Server Side Includes). That's it!

Anyways, I have tried to get this to work and I'm getting an error message "[an error occurred while processing this directive]"

Here's what I did:

1. In db.cgi file, I added:

Code:
sub view_records_ssi {
# --------------------------------------------------------
# This is called to display list of organizations
my ($status, @hits) = &query("view");
if ($status eq "ok") {
&html_view_success_ssi(@hits);
}
else {
&html_view_failure_ssi($status);
}
}

2. In html.pl, I added:

Code:

##########################################################
## SSI SCRIPTS ##
##########################################################
sub html_record_ssi {
# --------------------------------------------------------
# Display a list of organization names
my (%rec) = @_;
print qq|$rec{'Name'}<br />|;
}
sub html_view_success_ssi {
my ($i);
my (@hits) = @_;
my ($numhits) = ($#hits+1) / ($#db_cols+1);
my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits);
my ($count) = ($numhits);
for (0 .. $numhits - 1) {
if($count && $i > $count-1) { last; }
if(!($i%5) && $i) { print "<BR>"; }
$i++;
&html_record_ssi (&array_to_hash($_, @hits));
}
}
sub html_view_failure_ssi {
my ($message) = $_[0];
print qq|
<$font><P>There were problems with the search.<BR><BR>
Reason:<$error_color><B>$message</B></FONT>
<BR><BR>We are working to fix this please check back later.</p>
|;
}

3. In my shtml file I added:

Code:
<!--#include virtual="/cgi-bin/statements/db.cgi?db=default&uid=default&Nane=*&sb=7&so=descend&mh=25&view_records_ssi=View+Records"-->

Once I get it working I will need to bump up the max hits but not worried about that right now, all I'm trying to do is display the list of names for a dropdown box on a form. I use SSI files all the time and have never had this problem.

PLEASE HELP Angelic
Quote Reply
Re: [jmortimer] Viewing data from other HTML files In reply to
Hi all, just wanted to let you know that I got it working. Not sure exactly what the problem is but I did notice that if I included the full URL in the include statement it did not work -- beyond that it seems to work find. ugh. So, thank you <myself>! Laugh