Gossamer Forum
Home : Products : DBMan SQL : Development, Plugins and Globals :

Global causes blank page?

Quote Reply
Global causes blank page?
Hi. I'm trying to write a global, that will grab links from Overture, depending on the 'db' you are accessing (i.e, cars, books, houses, etc). The global is as follows;

Code:
sub {

my $Query = $_[0];
my $Limit = $_[1] || 10;

my $page = get("http://xml.uk.overture.com/d/search/p/partner/xml/fast/?mkt=uk&maxCount=10&Partner=site_co_uk&Keywords=$Query");

my $ref = XMLin($page);

# if we don't have any results, then lets return nothing, as there is
# nothing more we can do here...
if (!$ref->{ResultSet}->{Listing}->[0]->{description}) {
return '';
}

#work out how many listings we have...
my $Count;
for (my $i = 0; $i <= 10; $i++) {
if ($ref->{ResultSet}->{Listing}->[$i]->{title}) { next; } else { $Count = $i - 1; }
}

# just a fail safe, in case we get more links than we actually want to show...
if ($Count > $Limit) { $Count = $Limit - 1; }

# now lets go through, and create the HTML for it...
my $html_links;
for (my $count = 0; $count <= $Count; $count++) {

# get the variables all setup...
my $Description = $ref->{ResultSet}->{Listing}->[$count]->{description};
my $Title = $ref->{ResultSet}->{Listing}->[$count]->{title};
my $URI = $ref->{ResultSet}->{Listing}->[$count]->{ClickUrl}->{content};
my $ClickURL = $ref->{ResultSet}->{Listing}->[$count]->{siteHost};

# put the links into HTML format...
$html_links .= GT::Template->parse('overture_link', { Description => $Description, Title => $Title, URL => $URI, ShowURL => $ClickURL });

}

# now lets send it back to the template....
return $html_links;

}

For some reason, when this global is activated, it just shows a blank page (if its not called, then it shows the page fine).

This is my first DBMan SQL global, so any help is much appreciated :) Does DBMan SQL not have a Links::SiteHTML::display() ? Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Global causes blank page? In reply to
Ok, this stuff is weird in DBManSQL ....Laugh

Code:
sub {

use LWP::Simple;
use XML::Simple;

my $Query = shift;

my $page = get("http://xml.uk.overture.com/d/search/p/partner/xml/fast/?mkt=uk&maxCount=10&Partner=site_co_uk&Keywords=$Query");

my $ref = XMLin($page);

# if we don't have any results, then lets return nothing, as there is
# nothing more we can do here...
if (!$ref->{ResultSet}->{Listing}->[0]->{description}) {
return "";
} else {
return { overture_check2 => 1 };
}

}


...called with...

<%check_overture('book',10)%>

... however, it doesn't create the <%overture_check2%> tag... like it does in LSQL ....

If I try a 'return' above the get() stuff, it doesn't actuall show the value in the HTML ... it just doesn't show anything...

Any DBMan SQL gurus out there know whats going on? I was hoping it would be the same kinda thing as LSQL :(

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Global causes blank page? In reply to
Anyone? Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Global causes blank page? In reply to
Unimpressed

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Global causes blank page? In reply to
I've tracked the error down to;

$html_links .= GT::Template->parse('overture_link.html', { Description => $Description, Title => $Title, URL => $URI, ShowURL => $ClickURL });


Can anyone see anything wrong with this format?

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Global causes blank page? In reply to
Does no-one know what would cause this? Its been hassling me for 2 days now Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Global causes blank page? In reply to
Does anyone actually visit this forum? Unsure

I managed to get around this problem by hard coding the HTML, and not using the DBMan SQL template parse.. but I would be interested in knowing why the code didn't work :)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Global causes blank page? In reply to
Sorry about the late reply! I tried your code on mine local and it worked just fine. If you can send the you admin access info via email, I will test it out.

TheStone.

B.
Quote Reply
Re: [TheStone] Global causes blank page? In reply to
Weird. Ah well, I was just curious as to why it didn't work. If its hassle, then don't wory about it. Its all working ok now.. I was just wondering, for future reference :)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates