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

Linebreak Global Question

Quote Reply
Linebreak Global Question
Hi-

I have a field that has multiple values. I figured out a global (linebreak), that will list the values of the field with linebreaks and a bullet point (*) when I place the following tag:

* <%linebreak($States)%>

So if the States field has the values:

Arizona California New York Extra Value

Then the global will include the line breaks so that it is displayed:

*Arizona
*California
*New York
*

The code for the global is:

sub {
my $fieldname = shift;
my $output = $fieldname;
$output =~ s/\n/<BR>*\n/g;
$output =~ s/Extra Value//g;
return $output;
}

This works fine, but I have a value at the end of the value list for States called: Extra Value. I don't want to display this value. The above line in the code ($output =~ s/Extra Value//g;) will remove it, but it will still show the bullet point (*) with nothing after it.

Does anyone know if there is a way to modify this global to also remove the bullet point (*) from the one output line at the end where it removes the Extra Value?

--Frank
Quote Reply
Re: [FrankM] Linebreak Global Question In reply to
O.k. I could finally figure that out with more experimenting:

sub {
my $fieldname = shift;
my $output = $States;
$output =~ s/\nExtra Value//g;
$output =~ s/\n/<BR>*\n/g;

return $output;
}