Gossamer Forum
Home : Products : DBMan : Customization :

Relational &/or use $rec{'Field'} in sub view_success HELP !!!!!!!!!!

Quote Reply
Relational &/or use $rec{'Field'} in sub view_success HELP !!!!!!!!!!
Hello,
I would like to use the 'Catagory' Field in my database to determine which image is used at the top of the page. I have tried using the loop below but I can not figure out how to get the 'Catagory' field information to the loop to be used in the condition statement.

if ($rec{'Catagory'} eq "Fuchi+Kashira"){
print qq|<img src="../images/caligraphy/large/fuchikashira.gif"><br>
<!-- #BeginEditable "body" -->
|;
}

if ($rec{'Catagory'} eq "Fuchi+Kashira"){
print qq|<img src="../images/caligraphy/large/fuchikashira.gif"><br>
<!-- #BeginEditable "body" -->
|;
}
if ($rec{'Catagory'} eq "Juyo+Hin" ){
print qq|<img src="../images/caligraphy/large/juyohin.gif"><br>
<!-- #BeginEditable "body" -->
|;
}

if ($rec{'Catagory'} eq "Katchu+Hin" ){
print qq|<img src="../images/caligraphy/large/katchuhin.gif"><br>
<!-- #BeginEditable "body" -->
|;
}

if ($rec{'Catagory'} eq "Katana+Kake" ){
print qq|<img src="../images/caligraphy/large/katanakake.gif"><br>
<!-- #BeginEditable "body" -->
|;
}

if ($rec{'Catagory'} eq "Kodogu" ){
print qq|<img src="../images/caligraphy/large/kodogu.gif"><br>
<!-- #BeginEditable "body" -->
|;
}
if ($rec{'Catagory'} eq "Kozuka" ){
print qq|<img src="../images/caligraphy/large/kozuka.gif"><br>
<!-- #BeginEditable "body" -->
|;
}

if ($rec{'Catagory'} eq "Shiki" ){
print qq|<img src="../images/caligraphy/large/shiki.gif"><br>
<!-- #BeginEditable "body" -->
|;
}
if ($rec{'Catagory'} eq "Tachi+Kake" ){
print qq|<img src="../images/caligraphy/large/tachikake.gif"><br>
<!-- #BeginEditable "body" -->
|;
}
if ($rec{'Catagory'} == Token ){
print qq|<img src="../images/caligraphy/large/token.gif"><br>
<!-- #BeginEditable "body" -->
|;
}
}


I am currently tring to get the relational mod working from the JPDeni site. I thought I would make the Catagory database the one side and have each record conatin the 'Catagory','Image'&'Foot' information. Then the many side would be the items and 'Catagory' would be the common field. I have the demo working but I can't get around the userid problem. The userid is the same for all items so I want the 'Catagory' field to determine which items are listed between the 'Image' & 'Foot' fields of the one database.
I hope this makes sense. I can clarify if you email.

Here is a link to the working dbman without alterations.
http://www.ikkyudo.com/dbarmor/db.cgi?db=default&uid=default&Key=&Catagory=Katchu+Hin&view_records=1

And the html file:
http://www.ikkyudo.com/text/html.txt

I have been searching through the thousands of threads and will contnue to look but would appreciate any help.
Thank you.
Quote Reply
Re: [Hello World!] Relational &/or use $rec{'Field'} in sub view_success HELP !!!!!!!!!! In reply to
This thread in the FAQ (under Images)may be of some help:

Display differnet graphics based on the search results

original thread:

Subject Detecting when a search is being performed
prospero 13-Sep-00
Thread: http://gossamer-threads.com/p/105079

If not I know there are other threads related to adding a category header within the results. I'm not sure I understand how you have this setup using the relational datbase though.

Hope this helps

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/
Quote Reply
Re: [Hello World!] Relational &/or use $rec{'Field'} in sub view_success HELP !!!!!!!!!! In reply to
Thank you. I found it and will try it out now.
Quote Reply
Re: [Hello World!] Relational &/or use $rec{'Field'} in sub view_success HELP !!!!!!!!!! In reply to
Here's another thread reference I just found:

thread: 7577
Trying to create two different short displays...
RSBlack Oct 14, 1999

You can search by the title to find the thread.

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/
Quote Reply
Re: [Hello World!] Relational &/or use $rec{'Field'} in sub view_success HELP !!!!!!!!!! In reply to
The first thread kind of works but I don't want the image to repeat for each record. I will go and look at the second thread now.
Quote Reply
Re: [Hello World!] Relational &/or use $rec{'Field'} in sub view_success HELP !!!!!!!!!! In reply to
Hi,
I went back to the first thread's method and placed the code in the sub html_view_success and it worked. I have a set of if statements it calls from the global section. It would be great to get the relational thing working so that I coult keep all of the info in a database instead of an html file but this will do for now.

Thanks a lot for your help. I really needed to get this done today and your really saved me.
Quote Reply
Re: [Hello World!] Relational &/or use $rec{'Field'} in sub view_success HELP !!!!!!!!!! In reply to
Here is a helpful trick I use for something similiar:

First, I set my image directory as a variable:

Code:
$imagepath = 'http://www.yourdomain.com/images';

Then I name the image the same as the category (or in my case UserID). Example UserID of "Bob1234" corresponds to an image called Bob1234.gif).

Now I can have the image part print one time without all of the repetitions by using:

Code:
if ($rec{'UserID'} eq "$rec{'UserID'}"){
print qq|<img src="$imagepath/$rec{'UserID'}.gif"><br>
<!-- #BeginEditable "body" -->
|;
}

Of course this may not work in your case, but it saved me from having several hundred if/then statements.

Using a variable for all of your directory paths is not necessary, but if you have all of your images in one directory it certainly help keep you html.pl file size down. I do the same thing for scripts and stylesheets as well.

Good Luck!
Quote Reply
Re: [Watts] Relational &/or use $rec{'Field'} in sub view_success HELP !!!!!!!!!! In reply to
I'm not sure what problems you are having with the relational mod, but there are several examples and threads related to working with this mod in the FAQ noted below.

It sometimes help to see what others have done to know exactly how to set your up to accomplish what you need. And it's less time consuming than searching all the threads in the support forum.

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/