Gossamer Forum
Home : Products : DBMan : Customization :

Bolding prevents graphic from displaying

Quote Reply
Bolding prevents graphic from displaying
how do I get it NOT to bold based on the yes/no value of a field (isPick)

Code:
# Bold the results
if ($db_bold and $in{'view_records'}) {
for $i (0 .. (($#hits+1) / ($#db_cols+1)) - 1) {
$offset = $i * ($#db_cols+1);
foreach $field (@search_fields) {
$hits[$field + $offset] =~ s,(<[^>]+>)|($regexp_bold[$field]),defined($1) ? $1 : "<B>$2</B>",ge;
}
}
}


Actually, if $2 above is part of filename...well, you understand, the graphic won't display.


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] Bolding prevents graphic from displaying In reply to
I'm not 100% clear but isn't it just a matter of using an "if" block around the bolding code?

eg...

if ($in{isPick}) {

}
Quote Reply
Re: [Paul] Bolding prevents graphic from displaying In reply to
thanks, I thought there might be some cryptic perl way to do it...but just an old fashioned IF statement works. But I may just turn off bolding althogether....

Code:
# Bold the results

if ($db_bold and $in{'view_records'}) {
for $i (0 .. (($#hits+1) / ($#db_cols+1)) - 1) {
$offset = $i * ($#db_cols+1);
foreach $field (@search_fields) {
if (not $in{isPick}) {
$hits[$field + $offset] =~ s,(<[^>]+>)|($regexp_bold[$field]),defined($1) ? $1 : "<B>$2</B>",ge;
}
}
}
}



turns out that dbman also bolds the yes/no in the field so you won't get the correct results. For example, if you have you have something like <%if isNew eq 'Yes'%>do something <%endif%> in your html_record.html (link.html for you Links 2 folks ) then the IF evaluates to false and does not execute ( dbman sees it as <b>Yes</b> and not Yes).

So, I'm gonna just turn bold off.


ps: Paul, you should be doing this for me!


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."

Last edited by:

esm: Feb 13, 2003, 2:44 PM
Quote Reply
Re: [esm] Bolding prevents graphic from displaying In reply to
Wouldn't it have been easier to add the check to the first if statement?

Code:
($db_bold and $in{'view_records'} and ($in{'isPick'} eq "No"))

I'm fairly sure that "Yes" and "No" do not equate to true and false values, you'd probably have to use 1 and 0 for that.
Quote Reply
Re: [wysardry] Bolding prevents graphic from displaying In reply to
you may be right about the yes/no with perl. seems like some languages did allow it....I may test it if I get a chance.

I figured perl would have some exotic way to do what I was suggesting. I may give that a try just for the hang of it. but i'm going to turn bold off for the time being...

Thanks


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] Bolding prevents graphic from displaying In reply to
Quote:
I'm fairly sure that "Yes" and "No" do not equate to true and false values, you'd probably have to use 1 and 0 for that.

wysardry is right. 1 and 0 are true and false but Yes and No are both true.
Quote Reply
Re: [esm] Bolding prevents graphic from displaying In reply to
   The bolding process is slighlty different in Links 2 as shown below. How do I incorporate this code into the dbman code in my original question

Code:
# If we want to bold the search terms...
if ($search_bold) {
foreach $term (@search_terms) {
# This reg expression will do the trick, and doesn't bold things inside <> tags such as URL's

$link_results =~ s,(<[^>]+>)|(\Q$term\E),defined($1) ? $1 : "<STRONG>$2</STRONG>",gie;
$category_results =~ s,(<[^>]+>)|(\Q$term\E),defined($1) ? $1 : "<STRONG>$2</STRONG>",gie;
}
}


Here is the dbman code for the same thing

Code:


# Bold the results
if ($db_bold and $in{'view_records'}) {
for $i (0 .. (($#hits+1) / ($#db_cols+1)) - 1) {
$offset = $i * ($#db_cols+1);
foreach $field (@search_fields) {
$hits[$field + $offset] =~ s,(<[^>]+>)|($regexp_bold[$field]),defined($1) ? $1 : "<B>$2</B>",ge;


}
}


is it as simple as

Code:
$hits[$field + $offset] =~ s,(<[^>]+>)|(\Q$term\E),defined($1) ? $1 : "<STRONG>$2</STRONG>",gie;


But there doesn't seem to be alot of difference between the right hand side of either. both start with s,(<[^>]+>)|( which I think is the part dealing with <> tags...


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."

Last edited by:

esm: Feb 19, 2003, 6:06 AM