Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Display multiple images on a link

Quote Reply
Display multiple images on a link
Greetings,
I am trying to diplay many region images on a specific link.
I created a field in Links DB called "Region" but defined it as ENUM... but in the form display i defined it as Multi-Select and I put values like: "USA, Canada, UK...".
Now, I was to display USA flag and Canada flag next to a link.
I addeded this code in the link.html template...
However, everytime I select two values or more.. I get the image url below like: http://www.mydomain.com/flags/USACanada.gif
but I want it as you can see... to split them to USA.gif and to Canada.gif
All image flags are uploaded to flags directory to reference them on all images.
So I am missing something over here...

My question, how do I define the "Region" in Links DB to allow multiple selections, and how to break the images when they are displayed on the link inside the category.
thank you
Mark

Code:
<%if Region%>
<%-- loop Region --%>
<img border="0" src="<%config.build_root_url%>/flags/<%Region%>.gif" height="14" width="25" border=0></a>
<%-- endloop --%>
<%endif%>

Last edited by:

Mark2: Oct 9, 2008, 8:08 PM
Quote Reply
Re: [Mark2] Display multiple images on a link In reply to
Hi,

Wrong forum ;) I've moved it for you.

I can't re3ember off the top of my head how this can be done (it needs to be done through a global). Lemme have a play, and I'll get back to you =)

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: [Mark2] Display multiple images on a link In reply to
Hi,

Ok, please try this.

format_multi_select
Code:
sub {
my @cut = split(/\n/, $_[0]);
use Data::Dumper;
my @loop;
foreach (@cut) {
push @loop, { value => $_ };
}
return { multi_select_loop => \@loop }
}

..then call with:

Code:
<%if Region%>
<%format_multi_select($Region)%>
<%loop multi_select_loop%>
<img border="0" src="<%config.build_root_url%>/flags/<%value%>.gif" height="14" width="25" border=0></a>
<%endloop%>
<%endif%>

That should do the trick =)

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] Display multiple images on a link In reply to
Smile.. so nice of you Andy.. it works perfectly... thank you much...

Cheers...
Mark