Home : Products : Gossamer Links : Discussions :

Products: Gossamer Links: Discussions: Help With Global: Edit Log

Here is the list of edits for this post
Help With Global
I have a simple global in and working now. I just want to jazz it up a bit.

Essentially, my problem is with alternate titles. I list them (things like possible English translations, alternate titles, etc) in a seperate field called "Eng_Title". In my database, I list all the alternate titles seperated by a "space-comma-space" delimiter, and this works fine. I have the global subsitite the "space-comma-space" with formatting- basically I italisize the entry, and put quote marks around it. Works fine. Here is my code:

sub {
use strict;
my ($rec) = @_;

my $short = $rec->{'Eng_Title'};
my $id = $rec->{'ID'};
$short =~ s/ , /<\/i>\", \"<i>/g;
return $short;
}

So here is what I want to do to spice things up. I would like the final subsitution in the list (if there is a list, sometimes I might only have one alt title) to be a '</i>" and "<i>'- adding an "and" in there. Not sure how to ONLY substitutre the last instance.

And I would also like to return a second variable- I do not care, a 1 and 0, a yes or no, I do not care, but some sort of flag to my template that says whether there is one or more than one item in the list, so I can add a "s" to the banner. So in the template, it would be: Alternate Title<%if flag%>s<%endif%>. Make sense?

If you want to see this in action, here is the page I have dummied up for testing:

Test Page

Look under the "Cartoon Production Information" banner for the results...

Thank You!

dave

Big Cartoon DataBase
Big Comic Book DataBase

Last edited by:

carfac: May 14, 2008, 9:14 AM

Edit Log: