Gossamer Forum
Quote Reply
Image Global error...
Weird. I'm trying to get the following global to work with an upload field;

Code:
sub {
my ($ID,$Field) = @_;
my $file = $DB->table('Links')->file_info($Field, $ID);
return $file->File_URL();
}

Its called with;

Code:
<%if ImageURL($ID,Image)%>

When I do this, I get an error:

Quote:
Can't call method "File_URL" on an undefined value at (eval 22) line 5.

If I add the following code in (after the 'shift' call);

Code:
return "ID: $ID, Field: $Field";

...I get;

Quote:
ID: 118, Field: Image

Anyone got any ideas why I'm having this problem? Unsure

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] Image Global error... In reply to
*bump*
Quote Reply
Re: [Andy] Image Global error... In reply to
I just tried it on my site and it works.

Try putting Image in quotes? Do you definitely have a field called Image in the Links table? Tongue
Quote Reply
Re: [afinlr] Image Global error... In reply to
Mmm..thanks for testing it. What version are you running?

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] Image Global error... In reply to
Sorry - I see that I wasn't paying enough attention Blush

I called it with <%ImageURL($ID,Image)%> which worked. I've just tried it again with <%if ImageURL($ID,Image)%> and got the same error as you. I have no idea why this causes a problem.

However, I think you can get round this with <%set Imageurl=ImageURL($ID,Image)%> and then use <%if Imageurl%>

Laura.

Quote Reply
Re: [afinlr] Image Global error... In reply to
What I ended up doing, was something like;

<%if Image1%>
<img src="<%ImageURL($ID,Image1)%>">
<%endif%>

That seemed to work fine Smile

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!