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

Have A Prob with a Global

Quote Reply
Have A Prob with a Global
Hi:

I have a global I use to shorten up one specific field for display on certian Detail pages. In essance, the object is to take a field longer than 75 characters (and some get into the 200-300's!) and bring it down to a "digest" size. Additionally, I use the one field for two fields of info, as you will see. For the "Digest", I remove the code to make it a seperate "apparent" field and just string it all together. The field is "Studio" which is the studio who makes a cartoon. As is sometimes the case (and in this specific example, it is Animaniacs), there is a Producing studio... and an animating studio. So, to make this two fields, I use this as an entry:

Warner Bros. Television Animation.<LI>Animation Studio</B>: Freelance Animators, Ltd.

When Incerted into my detail page, this will result in:

Warner Bros. Television Animation.
Animation Studio
: Freelance Animators, Ltd.

and when I "digest" this, it will result in:

Warner Bros. Television Animation, Freelance Animators, Ltd.

Here is the global to do that:

sub {

my $short1;

my $comma1;

my $cs1;

my ($rec) = @_;

my $stud = $rec->{'Studio'}; # Get the Info

$short1 =~ s/.<LI>Animation Studio<\/B>:/, /; # Remove the Animation Studio header, subsitute comma

$short1 =~ s/,<LI>Animation Studio<\/B>:/, /; # Same, and a test

if (length $stud < 45) { # If Studio is less than 45, do NOTHING

$short1 = $stud;

}

else { # If Studio is more than 45 characters...

$short1 = substr ($stud, 0, 75); #Cut it to 75 Characters

$short1 =~ s/\s\S+?$//;

$short1 =~ s/.<BR>/, /; #Remove a <BR> if there is one

$cs1 = chop($short1);

until ($comma1 eq ",") { ### Loop until we find a comma

$comma1 = chop($short1); # Cut it off AT the comma

}

$short1 .= "..."; # Add a "..." so we know it is chopped

}

return $short1;

}



OK, this has been working well and good for me for a while... But it is crashing me on one SPECIFIC entry.... and I cannot figure out why. When Studio = Warner Bros. Television Animation.<LI>Animation Studio</B>: StarToons.

This goes into a death spiral... I have been all over the code (as best I can!) and I cannot figure out why this just does not return:

Warner Bros. Television Animation....

Any Ideas?

Thanks!

dave

Big Cartoon DataBase
Big Comic Book DataBase
Subject Author Views Date
Thread Have A Prob with a Global carfac 2988 Apr 21, 2003, 8:41 AM
Thread Re: [carfac] Have A Prob with a Global
Paul 2926 Apr 21, 2003, 8:52 AM
Thread Re: [Paul] Have A Prob with a Global
carfac 2924 Apr 21, 2003, 9:18 AM
Thread Re: [carfac] Have A Prob with a Global
Paul 2926 Apr 21, 2003, 9:39 AM
Post Re: [Paul] Have A Prob with a Global
carfac 2938 Apr 21, 2003, 9:50 AM
Thread Re: [Paul] Have A Prob with a Global
Paul 2913 Apr 21, 2003, 10:12 AM
Post Re: [Paul] Have A Prob with a Global
carfac 2892 Apr 22, 2003, 7:34 AM