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


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
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.