Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

[NEW] TodaysRandomFact v1

Quote Reply
[NEW] TodaysRandomFact v1
Hi,

As per a request from someone on this forum, I've now written a "Random Fact" system for LinksSQL 2.x > and GLinks 3.x).

Full details can be found here (screenshots to come at some point <G>)

http://ultranerds.com/...bin/details/153.html

Price: $15
Ease of Installation: Very easy Smile

If you have any questions, please don't hesitate to ask.

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] [NEW] TodaysRandomFact v1 In reply to
Andy,
Is this is the pro package?

CCUnet
my Christian web
Quote Reply
Re: [ccunet] [NEW] TodaysRandomFact v1 In reply to
Hi,

Yup, should be Smile

http://ultranerds.com/...packages.cgi?p=Ultra gives a full list of them. Should also have a few new ones out today too <G>

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] [NEW] TodaysRandomFact v1 In reply to
Is is possible just to display random facts no matter of date?

Let say, I put 20 facts in database, put code on page, and those fact are random display every day (or even every time someone visit site).

UnReal Network
Quote Reply
Re: [deadroot] [NEW] TodaysRandomFact v1 In reply to
Hi,

It does that already Smile

Code:
$tbl->select_options('ORDER BY RAND()');

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] [NEW] TodaysRandomFact v1 In reply to
So I really don't need to add Date when adding fact?

UnReal Network
Quote Reply
Re: [deadroot] [NEW] TodaysRandomFact v1 In reply to
Sorry, my mistake. You DO need the Date.

To get a random entry, just add this global:

get_random_fact

Code:
sub {
my $tbl = $DB->table('Facts');
$tbl->select_options('ORDER BY RAND()');
my $fact = $tbl->select()->fetchrow_hashref;
return $fact->{Fact};
}

Then call with:

Fact: <%get_random_fact%>

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] [NEW] TodaysRandomFact v1 In reply to
Cool. That worked.

Also, is it possible to change charset for the added fact in database? When I try to add fact to database it wont' save with chars (local chars) I put in field for input.

UnReal Network
Quote Reply
Re: [Andy] [NEW] TodaysRandomFact v1 In reply to
Surely that query is selecting ALL data because you didn't use LIMIT?
Quote Reply
Re: [Wychwood] [NEW] TodaysRandomFact v1 In reply to
Hi,

Oops - you've got a point!

deadroot, use this instead:

Code:
sub {
my $tbl = $DB->table('Facts');
$tbl->select_options('ORDER BY RAND()','LIMIT 1');
my $fact = $tbl->select()->fetchrow_hashref;
return $fact->{Fact};
}

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] [NEW] TodaysRandomFact v1 In reply to
Any idea how to display local chars from facts that are put in database?

Or how to save in database with special chars...

Regards.

UnReal Network
Quote Reply
Re: [DeadMan] [NEW] TodaysRandomFact v1 In reply to
Hi,

Not sure what you mean? I just tried on your site with "tražilica|2007-10-20" as bulk add - and it added it fine , with characters :

Quote:
ID 6
Fact 2007-10-20
Date tražilica

..or am I missing something?

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] [NEW] TodaysRandomFact v1 In reply to
did you tried "ć"?

Instead "ć" I got "?"

Regards.

UnReal Network
Quote Reply
Re: [DeadMan] [NEW] TodaysRandomFact v1 In reply to
Mmmm.. not sure, I see what you mean though.

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!