Gossamer Forum
Home : Products : DBMan : Customization :

two questions

Quote Reply
two questions
1) ive setup some configurations other than using defualt.foo how and what do i use to incorporate them? do i have to copy my db.cgi to another name? is this common?

2) i run a content based website and i want to call articles via SSI. is this possible and if so how? based on rowid?

any info is appreciated.

thanks.

------------------
http://www.linuxnewbie.org
Quote Reply
Re: two questions In reply to
Not sure if I understand completely, but I'll give it a shot.

Quote:
1) ive setup some configurations other than using defualt.foo how and what do i use to incorporate them? do i have to copy my db.cgi to another name? is this common?

I am not sure what you mean by this? We run 6 different DBMan databases and setup each database with a unique name and folder. Example: hardware news is stored in .../dbman/hardware_news/ and all the original default names have been changed to hardwarenews.cfg, hardwarenews.cgi, hardwarenews.db, etc.

Quote:
2) i run a content based website and i want to call articles via SSI. is this possible and if so how? based on rowid?

Not exactly sure what you have in mind with (rowid,) but I will give this a shot and see if it helps. Keep in mind this is how we do it, others may have a different or better way but this has worked out great for us. Here is a link to the page that shows the output of the following DBMan code.

www.makeitsimple.com/news/technews/index.shtml


In default.cgi (or whatever you named it) setup a new subroutine:

################## V I E W _ R E C O R D S _ S S I ###################
sub view_records_ssi {

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

In default.cgi add the following to the the subroutine (main)

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




In your html.pl file setup the following new subtroutines:

########### R E C O R D _ S S I ########################

sub html_record_ssi {

my (%rec) = @_;
my $font_color = 'font face="Arial, Helvetica, sans-serif" size=2 color=”#808080”';
my $font = 'font size=1';

print qq|
<$font_color><A HREF= "$rec{'URL'}" target="_blank" class="link1">$rec{'Headline'} - $rec{'Type'}</A><$font>
  ($rec{'Source'})  $rec{'PostTime'}</Font></font><br></font>
|;
}

############ V I E W _ S U C C E S S _ S S I ########################

sub html_view_success_ssi {

my ($i);
my (@hits) = @_;
my ($numhits) = ($#hits+1) / ($#db_cols+1);
my ($count) = ($numhits);
my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits);

for (0 .. $numhits - 1) {

if($count && $i > $count-1) { last; }
if(!($i%5) && $i) { print "<BR>"; }
$i++;

&html_record_ssi (&array_to_hash($_, @hits));
}
}

############ V I E W _ F A I L U R E _ S S I ########################

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>
|;
}

After you add all of the above it’s time to try the SSI on a page, here is the call we use

<!--#include virtual="cgi-bin/dbman/hardware_news/hardwarenews.cgi?db=hardwarenews&uid=default&Headline=*&sb=7&so=descend&mh=25&view_records_ssi=View+Rec ords"-->

After you get SSI working then you can change the output of (sub html_record_ssi) to suit your needs.

Asside from possible copy/paste errors I think the above code should give a good idea of how to get SSI working.

Good Luck! and may the SSI force be with you. Smile

------------------
Larry "NgtCrwlr" Mingus
www.makeitsimple.com



[This message has been edited by NgtCrwlr (edited October 30, 1999).]
Quote Reply
Re: two questions In reply to
I don't know what ???.shtml page you are going to put the SSI call into so I will try to give an example.

Paste the code below into a table on a test page (www.warcraft.net/test.shtml). I am assuming that the path to your DBMan is www.warcraft3.net/tester/
Make sure that you include the <!--#include virtual="

<!--#include virtual="tester/db.cgi?db=default&ID=*&sb=0&so=descend&mh=5&view_records_ssi=View+Records"-->

Try that and let me know how it turns out.

------------------
Larry "NgtCrwlr" Mingus
www.makeitsimple.com



[This message has been edited by NgtCrwlr (edited November 01, 1999).]
Quote Reply
Re: two questions In reply to
By the way, make sure that you modify sub html_record_ssi to the proper field names that you use in your database. You also need to change the output format of the print statement to suit your data.

print qq|
<$font_color><A HREF= "$rec{'URL'}" target="_blank" class="link1">$rec{'Headline'} - $rec{'Type'}</A><$font>
($rec{'Source'}) $rec{'PostTime'}</Font></font><br></font>


------------------
Larry "NgtCrwlr" Mingus
www.makeitsimple.com

Quote Reply
Re: two questions In reply to
I dont understand where the following would go





In default.cgi add the following to the the subroutine (main)

elsif ($in{'view_records_ssi'}) { if ($per_view) { &view_records_ssi; } else { &html_unauth; } }
Quote Reply
Re: two questions In reply to
ok i figured that out but I dont understand what view_records_ssi should be equal to in the url

like right now i have

http://www.warcraft3.net/tester/db.cgi?db=default&uid=default&view_records_ssi=*&ID=*

but that does not work right

[This message has been edited by Sameer2 (edited November 01, 1999).]
Quote Reply
Re: two questions In reply to
Yes I had modified that correctly.
On that include url you gave me, I am assuming you accidently left off uid=default
still I get unkown action
you dont have to know which ***.shtml page I am going to use because the ssi just includes some other page. Basically, this is to avoid two <html> and two <body> etc statements

If you could: just use this url
http://www.warcraft3.net/tester/db.cgi?db=default&uid=default
and try to find a view_records_ssi in the url to work
I think I installed it right, and I did change the record ssi subroutine
so basically I think the thing is installed right but I can't figure out what url to use
Quote Reply
Re: two questions In reply to
I don't know if this helps, but I have written a Mod that extracts Categories of records in DBMAN and lists them via a separate "static" file, and can be called via SSI.

This Mod can be written to include almost any dynamic content in DBMAN and print on a web page outside of DBMAN via SSI.

If you want the Mod, take it from this address:

anthrotech.com/cgi/dbman/mods/records.txt

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: two questions In reply to
Hi Eliot,

I think what we have here is Sensei is misunderstanding SSI. I think I am close to having him up and running.

Sensei -- Yes I messed up and forgot to include &UID=default… oop’s. Sorry Frown

Now on to a little explanation of SSI. It really would help if I knew what page you are trying to display your DBMan records on because it affects the path that you use.

I think you are not understanding how SSI works. You don't call DBMan and have it create a page, instead you create a page (test.shtml or whatever) and call DBMan from within it to fill in data on that page. The SSI call has to come from an .shtml page in most cases. If you create a page (test.shtml) and put the SSI line in a table on that page, it will call DBMan and fill in the table with the output of sub html_record_ssi.

You cannot use sub view_records_ssi directly you have to call it from an .shtml page with an SSI call.

I’ll stop here and see how we are doing.

------------------
Larry "NgtCrwlr" Mingus
www.makeitsimple.com

Quote Reply
Re: two questions In reply to
Yes, I am very familiar with ssi.
My news script uses ssi.
Every page on the site is created using ssi with a call of top.shtml and bottom.shtml
see, like lets take units.shtml for example
i put includes top.shtml then the units content then include bottom.shtml
but top.shtml and bottom.shtml are actual pages (one containing header, one containing footer)
so ssi requires for their to be a page that I am calling
if their was no top.shtml, i could not call it
and in this I need the url to call, I can look at this within the .shtml page or outside of it as it would look without ssi

here is it using ssi: http://www.warcraft3.net/testin.shtml
and here without ssi:
http://www.warcraft3.net/tester/db.cgi?db=default&uid=default&ID=*&sb=0&so=descend&mh=5&view_records_ssi=View+Records

[This message has been edited by Sameer2 (edited November 01, 1999).]
Quote Reply
Re: two questions In reply to
nightcrawler it was sameer not me who questioned you btw.

and yes i understand ssi Smile.

i think elliots mod is what i was looking for.

------------------
www.linuxnewbie.org
Quote Reply
Re: two questions In reply to
Well Sensei,

I just looked at the output of testin.shtml and you are still calling DBMan wrong because you are ending up with a whole DBMan page in your testin.shtml, which results in two <head> and <body> tags and this is never going to work right. Yes, IE will display it but it is still broken and you are going to run into problems down the road.

Your explanation of how you are currently using SSI doesn't make sense to me. When you include a file, the file name should be .txt .html .htm or similar not .shtml. The only pages that should end in .shtml are the pages that do the calling.

I am willing to get you going, but we have to start from scratch. You will have to follow exactly what I say or we aren't going to get anywhere, or it will take forever. Wink

------------------
Larry "NgtCrwlr" Mingus
www.makeitsimple.com

Quote Reply
Re: two questions In reply to
Well doh! I am sorry Sensei I obviously missed the fact that Sammeer2 joined in. Big Ooop's Wink

Glad that Eliots mod worked for you.

------------------
Larry "NgtCrwlr" Mingus
www.makeitsimple.com

Quote Reply
Re: two questions In reply to
np nightcrawler

i tried your hack but i couldnt get it working.

i tried copying all teh files to a new folder and the new folder area wouldnt work.

weird.

------------------
www.linuxnewbie.org
Quote Reply
Re: two questions In reply to
Sameer2 -- If you want me to continue helping you, start a new SSI help thread and then email me to let me know you are ready. Otherwise we will be flooding Sensei's mail box with unnecessary notify emails.

Cheers!


------------------
Larry "NgtCrwlr" Mingus
www.makeitsimple.com

Quote Reply
Re: two questions In reply to
Sensei - If you want to work on getting my SSI mod to work let me know, I would be happy to help. I use that mod in different variations on six different DBMan databases on our site and it works great.

Cheers!

------------------
Larry "NgtCrwlr" Mingus
www.makeitsimple.com