Gossamer Forum
Quote Reply
PageBuilder...
Hi,

Got a pretty simple (hopefully) question. Can PageBuilder work with conditions to show paid links?

TIA

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] PageBuilder... In reply to
You can set conditions for each template/page you build. I'm using it extensively with one of my GLinks installations.
Quote Reply
Re: [Alba] PageBuilder... In reply to
Hi,

Thanks for the reply. I'm not really sure what condition to use though. Basically I need all isPaid links to show up on this page.

Has anyone done this before, since LSQL 2.2?

TIA

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] PageBuilder... In reply to
I think you can do isPaid=Yes as a condition to filter links

CCUnet
my Christian web
Quote Reply
Re: [ccunet] PageBuilder... In reply to
Hi,

Thanks, but that doesn't work either :(

I've now just written a global to do the job, as I can control more of whats being shown that way. However, HOW do we know if a link has been paid for? I've tried;

Expiry_Date => UNLIMITED

..and a few other methods... but none seem to work :/

TIA

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] PageBuilder... In reply to
How about

<%if wasPaid and not isExpired%>
Quote Reply
Re: [Alba] PageBuilder... In reply to
Hi,

Yeah.. I need to query the database though :/

I tried;

Expiry_Date > 2147483647

...but that doesn't seem to give me the right results :|

TIA

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] PageBuilder... In reply to
I still haven't fully understood where the 2147483647 comes from.

When I convert it into a time I get 00:00:00 but when I try to convert it into a date or date & time it appears to be too wide for a spreadsheet field. If I convert a yyyy-mm-dd formatted date into a number, it is a different number from the one that GLinks (therefore Unix?) displays. I had been trying to enter expiry dates in a spreadsheet for importing.

I also don't understand why the admin Expiry_Date has to be entered as yyyy/mm/dd when all the other admin date fields are yyyy-mm-dd.
Quote Reply
Re: [Alba] PageBuilder... In reply to
Read my post about it here:
http://www.gossamer-threads.com/...i?post=278088#278088

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [Alba] PageBuilder... In reply to
I wouldn't advise using any of the isUnpaid, paymentsEnabled, isFree, isExpired, wasPaid, isNotify variables since they're only apply to a link that the current user owns (so for paid links that someone else owns, these variables won't be set). However, in 3.x, a isPaidLink variable was added which will tell you if a link is a paid link.

Figuring out if a link is paid is pretty simple. First of all, payments must be enabled ($CFG->{payment}->{enabled}), the other part is understanding how ExpiryDate works. The ExpiryDate is the unix time of when the link expires. If ExpiryDate <= time, then the link has expired. There are however, three other values which have a slightly different meaning. These are defined as constants in Links.pm: UNPAID (awaiting payment), UNLIMITED (does not require payment or a lifetime payment), and FREE (free link).

Adrian
Quote Reply
Re: [brewt] PageBuilder... In reply to
Hi,

Thanks for the explanation :)

So something like this?

Code:
sub {

use GT::Date;
my $time = GT::Date->timelocal();

my $table = $DB->table('Links');
# 'ExpiryDate ','<>','2147483647'
my $sth = $table->select( GT::SQL::Condition->new('ExpiryDate','>',$time) );
# my $sth = $table->select( GT::SQL::Condition->new('ExpiryDate' => '=' => 'COMPLETED') ) || die $GT::SQL::error;

my @links;
while (my $hit = $sth->fetchrow_hashref) {
push @links, $hit;
}
return { links_loop => \@links };
}

TIA

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] PageBuilder... In reply to
*bump* .. is my above code right? Angelic

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] PageBuilder... In reply to
Well, considering I don't know anything about the Pagebuilder plugin, I don't really know what you're trying to do. If you're just trying to fetch all the non-expired/free links then that should work, though it could be much shorter:
Code:
sub {
my $links = $DB->table('Links')->select(GT::SQL::Condition->new('ExpiryDate' => '>' => time))->fetchall_hashref;
return { links_loop => $links };
}

Adrian

Last edited by:

brewt: May 10, 2005, 9:39 PM
Quote Reply
Re: [brewt] PageBuilder... In reply to
Hi,

Thanks ... that works a treat :) (still getting to grips with the expiry date stuff).

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] PageBuilder... In reply to
BTW, for anyone wanting a refined version to grab JUST paid links;

sub {
my $links = $DB->table('Links')->select(GT::SQL::Condition->new('ExpiryDate' => '>' => time => 'ExpiryDate' => '!=' => '2147483647'))->fetchall_hashref;
return { links_loop => $links };
}

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] PageBuilder... In reply to
PS: use the constants

Adrian