Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Transform the result of a field checkbox into an image

Quote Reply
Transform the result of a field checkbox into an image
Hi
How I make to transform the result of a field checkbox into an image?
example: I have a called Field CreditCards and I have 6 item in this field, the return of the field would be MasterCard VISA AMEX etc. I have in a folder in the server /images/c_cards/MasterCard.gif and VISA.gif As I make the HTML appearing the image in the place of text: MasterCard AIMS AT?

Some idea?

Janio
Quote Reply
Re: [Janio] Transform the result of a field checkbox into an image In reply to
Hi,

Try this:

show_card_images
Code:
sub {

my @credit_cards_accepted = split /\n\r?/, $_[0];

my $cards;
$cards->{visa} = "/images/c_cards/visa.gif";
$cards->{mastercard} = "/images/c_cards/masterCard.gif";
$cards->{whatever} = "/images/c_cards/something.gif";

my $back;
foreach (@credit_cards_accepted) {
$back .= qq|<img src="$cards->{$_}" alt="$_" /> |;
}

return \$back;

}

..then call with:

Code:
<%show_card_images($CreditCards)%>

Untested, but should work

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Transform the result of a field checkbox into an image In reply to
Thanks a lot for help. It solved my problem.