Gossamer Forum
Home : Products : Gossamer Links : Discussions :

randomize includes?

Quote Reply
randomize includes?
Hi,
I'm trying to randomize two included templates called include_reviews.html and include_news.html

Here is the global I'm using
Code:
sub {
my @list = ('<%include_reviews.html%>', '<%include_news.html%>');
return $list[rand @list];
}

But the global does not include the template, it just prints out the text
<%include_reviews.html%>
or
<%include_news.html%>

Does anyone know how to randomize these templates?

Thanks
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] randomize includes? In reply to
Hi,

Mmm.. its not as simple as that really :/

You could try this:

Code:
sub {
my @list = ('include_reviews', 'include_news.html');
return Links::SiteHTML::display($list[rand @list]);
}

Totally untested, but I think it should work 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!
Quote Reply
Re: [Andy] randomize includes? In reply to
Upps, does'nt work, just making my site unavailable ;-)
Thanks
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] randomize includes? In reply to
Hi,

How about this:

Code:
sub {
my @list = ('include_reviews', 'include_news');
return Links::SiteHTML::display($list[rand @list]);
}

(I left a .html in the other global, so was trying to load include_news.html.html, , which would cause a fatal error :))

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] randomize includes? In reply to
Hi Andy,
works fine, I'm testing ...

Thanks
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] randomize includes? In reply to
O.K. after some testing I can say, it works perfect.
Now, it's possible to randomize templates and even the output from different globals could be randomized.

Thanks
Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] randomize includes? In reply to
Hi,

Glad to hear it 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!