Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Help With Global

(Page 2 of 2)
> >
Quote Reply
Re: [carfac] Help With Global In reply to
title_split

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] Help With Global In reply to
Thanks!

Hmmm... I am still not getting it for some reason....

Here is what I put in the template:

<%~if Eng_Title%>
<%set Eng_Title_loop = Eng_Title_1($Eng_Title)%>
<h4><b>English Title<%if Eng_Title_loop.length > 1%>s<%endif%></b>: <%loop Eng_Title_loop%><%if Eng_Title_loop.length > 1 and not first%><%if last%></i>" and "<i><%else%>,</i>" "<i><%endif%><%endif%>"<%loop_value%><%if last%>.<%endif%>"
<%endloop%>
</h4><br /><br />
<%~endif%>

The global which I called Eng_Title_1, looks like this:

sub {
my $title = shift;
return $title ? [split(/\s+,\s+/, $title)] : [];
}

When I run it, I get no output.... just:

English Title:

I pared it down to just this (in case I scrwed up the if..elses):

<%~if Eng_Title%>
<%set Eng_Title_loop = Eng_Title_1($Eng_Title)%>
<h4><b>English Title<%if Eng_Title_loop.length > 1%>s<%endif%></b>:
<%loop Eng_Title_loop%>
<%loop_value%>
<%endloop%>
</h4><br /><br />
<%~endif%>

Same... no data back...
dave

Big Cartoon DataBase
Big Comic Book DataBase

Last edited by:

carfac: May 14, 2008, 3:04 PM
Quote Reply
Re: [carfac] Help With Global In reply to
Well, you did change the template code...
Here's what you probably want:
Code:
<%~if Eng_Title%>
<%~set Eng_Title_loop = Eng_Title_1($Eng_Title)%>
English Title<%if Eng_Title_loop.length > 1%>s<%endif%>:
<%loop Eng_Title_loop%>
"<em><%loop_value%></em><%if Eng_Title_loop.length > 1%><%if not last%>,<%else%>.<%endif%><%endif%>"
<%set i = $Eng_Title_loop.length - 1%><%if Eng_Title_loop.length > 1 and $i == $row_num%> and<%endif%>
<%endloop%>
<%~endif%>

Adrian

Last edited by:

brewt: May 14, 2008, 3:18 PM
Quote Reply
Re: [brewt] Help With Global In reply to
Thanks Adrian.

I copied that EXACTLY... and I am NOT getting the results.

Here is my test page:

http://www.bcdb.com/...0489-Hakuja_Den.html

Look right under Cartoon Production Information...

The first "English Title" is your code...

The second is the Andy code (just so you can see it should show!)

Eng_Title_1 global is:

sub {
my $title = shift;
return $title ? [split(/\s+,\s+/, $title)] : [];
}


Template is:

<%~if Eng_Title%>
<%~set Eng_Title_loop = Eng_Title_1($Eng_Title)%>
English Title<%if Eng_Title_loop.length > 1%>s<%endif%>:
<%loop Eng_Title_loop%>
"<em><%loop_value%></em><%if Eng_Title_loop.length > 1%><%if not last%>,<%else%>.<%endif%><%endif%>"
<%set i = $Eng_Title_loop.length - 1%><%if Eng_Title_loop.length > 1 and $i == $row_num%> and<%endif%>
<%endloop%>
<%~endif%>

Sorry- I feel like an idiot for not seeing the problem. This is just abit above my level, though...
dave

Big Cartoon DataBase
Big Comic Book DataBase

Last edited by:

carfac: May 14, 2008, 3:48 PM
Quote Reply
Re: [carfac] Help With Global In reply to
Oh, what version of glinks are you using? Only 3.2 supports the <%set foo = functioncall()%>.

Otherwise, you'll have to change the global to something like:
Code:
sub {
my $title = shift;
return { Eng_Title_loop => ($title ? [split(/\s+,\s+/, $title)] : []) };
}

Adrian
Quote Reply
Re: [brewt] Help With Global In reply to
There we go! I am on 3.1! Sorry!

Tested the new global (nothing else changed).... same thing- no data...
dave

Big Cartoon DataBase
Big Comic Book DataBase

Last edited by:

carfac: May 14, 2008, 5:23 PM
Quote Reply
Re: [carfac] Help With Global In reply to
Oh, I forgot to mention that you'll need to change the <%set ...%> line to just:
Code:
<%Eng_Title_1($Eng_Title)%>

Adrian
Quote Reply
Re: [brewt] Help With Global In reply to
Adrian:

Thanks for sticking with it. Yep, that last one is the cherry on the sundae... works sweet!
dave

Big Cartoon DataBase
Big Comic Book DataBase
> >