Gossamer Forum
Home : Products : DBMan : Customization :

If, elseif, ifnot, endif

Quote Reply
If, elseif, ifnot, endif
I'd like to use "if" and "elseif" in my sub html_record

Code:
sub html_record {
# --------------------------------------------------------
# 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.

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

($db_auto_generate and print &build_html_record(%rec) and return);

#my $font_color = 'Font face="Tahoma, Verdana, Arial, Helvetica" Size=2 Color=#003399';
#my $font = 'Font face="Tahoma, Verdana, Arial, Helvetica" Size=2';

print qq|

<p class="info">

<div class="row clear">
<label for="Description" class="name">Description:</label>
<div class="value">
<STRONG>$rec{'Description'}</STRONG>
</div>
</div>

</p><BR>

|;

}

like this:

Quote:
<%if Level eq Basic%>
Basic
<%elseif Level eq Regular%>
Regular
<%endif%>

where "Level" in default.cfg file is as Level => [9, 'alpha', 40, 100, 0, 'Basic', 'Basic|Regular|Premium'],

Any suggestion is appreciated, many thanks in advance.
Quote Reply
Re: [katakombe] If, elseif, ifnot, endif In reply to
Anyone?
Quote Reply
Re: [katakombe] If, elseif, ifnot, endif In reply to
Are you using the SQL version of dbman?

I'd do:

Code:
if ($rec{'Level'} eq "Basic") {
print qq|Basic|;
}

if ($rec{'Level'} eq "Regular") {
print qq|Regular|;
}

You could do "else if", but I think it'll be elsif (no "e").

Last edited by:

Watts: Jul 17, 2007, 9:39 AM
Quote Reply
Re: [Watts] If, elseif, ifnot, endif In reply to
Watts wrote:
Are you using the SQL version of dbman?

I'd do:

Code:
if ($rec{'Level'} eq "Basic") {
print qq|Basic|;
}

if ($rec{'Level'} eq "Regular") {
print qq|Regular|;
}

You could do "else if", but I think it'll be elsif (no "e").

No, it's "flat file" DBMan.

Right now, I'm on holidays, but I'll try this, thanks. Smile