Gossamer Forum
Home : Products : Others : Gossamer Community :

random in community

Quote Reply
random in community
Hi Andy,
I have a global in glinks for randomizing some includes
Code:
sub {
my @list = ('include_review', 'include_letzte_downloads', 'include_letzte_updates', 'include_suchwoerter', 'include_top5_reviewed');
return Links::SiteHTML::display($list[rand @list]);
}

Now I'm trying to insert this global into gcommunity but I think this part has to be changed
return Links::SiteHTML::display($list[rand @list]);
but I don't know how?

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] random in community In reply to
Hi,

Probably need something more like:

Code:
my $template_set = $CFG->{system_template_set};
use GT::Template;
print GT::Template->parse($CFG->{path_private}.'/templates/'.$template_set.'/' . $list[rand @list] .'.html', { });

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] random in community In reply to
Hi Andy,
the templates are already in gcommunity, so I don't have to include them from glinks.
And I can include them already with the code from my fist post, but only as text. Html is printed as text?
I hope you understand what I mean.

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] random in community In reply to
Not sure what you mean - but try this:

Code:
sub {
my @list = ('include_review', 'include_letzte_downloads', 'include_letzte_updates', 'include_suchwoerter', 'include_top5_reviewed');
my $template_set = $CFG->{system_template_set};
use GT::Template;
return GT::Template->parse($CFG->{path_private}.'/templates/'.$template_set.'/' . $list[rand @list] .'.html', { });
}

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] random in community In reply to
Hi Andy,
that's the error
Code:
GT::Template::Parser (30988): Unable to open template file 'include_top5_reviewed.html': File does not exist. at GT::Template::_compile_template line 596

I mean, the html files that should be included are not in glinks they are in the gcommunity templates directory!

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] random in community In reply to
Hi,

Yup, thats where its trying to get that template from (not GLinks)

Try doing this before the "return":

Code:
return $CFG->{path_private}.'/templates/'.$template_set.'/' . $list[rand @list] .'.html'

...so we can see the full path of what its trying to access.

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] random in community In reply to
Hi Andy, that's the output
/cgi/community/private/templates/default/werbung_google_banner.htm
The path seems O.K.

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] random in community In reply to
.htm , or .html ??

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] random in community In reply to
html :-) I lost the l by copy and paste ;-)

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] random in community In reply to
Mmm ok, and /cgi/community/private/templates/default/werbung_google_banner.html definatly exists?

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] random in community In reply to
Hi Andy,
I think we are on the right way ;-)

With this code I have an output
Code:
sub {
my @list = ('werbung_amazon_buch', 'werbung_amazon_mp3', 'werbung_google_zeile', 'werbung_google_banner');
my $template_set = $CFG->{system_template_set};
use GT::Template;
print GT::Template->parse($CFG->{path_private}.'/templates/'.$template_set.'/' . $list[rand @list] .'.html', { });
}
have a look
http://www.gpaed.de/....cgi?do=user_lostpw;

The weird thing is. The output should be in the footer. But there you can see only a 1 and the output is on the top left?

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] random in community In reply to
Hi,

You have it as "print", not "return" - so its just printing it, not returning to the template ;)

Try changing:

Code:
print GT::Template->parse($CFG->{path_private}.'/templates/'.$template_set.'/' . $list[rand @list] .'.html', { });

to:

Code:
return GT::Template->parse($CFG->{path_private}.'/templates/'.$template_set.'/' . $list[rand @list] .'.html', { });

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] random in community In reply to
Code:
sub {
my @list = ('werbung_amazon_buch', 'werbung_amazon_mp3', 'werbung_google_zeile', 'werbung_google_banner');
my $template_set = $CFG->{system_template_set};
use GT::Template;
return GT::Template->parse($CFG->{path_private}.'/templates/'.$template_set.'/' . $list[rand @list] .'.html', { });
}

Now I have only the text output :-(
see:
http://www.gpaed.de/...y.cgi?do=user_lostpw

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] random in community In reply to
Try:

Code:
sub {
my @list = ('werbung_amazon_buch', 'werbung_amazon_mp3', 'werbung_google_zeile', 'werbung_google_banner');
my $template_set = $CFG->{system_template_set};
use GT::Template;
my $code = GT::Template->parse($CFG->{path_private}.'/templates/'.$template_set.'/' . $list[rand @list] .'.html', { });
return \$code;
}

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] random in community In reply to
Hi Andy, that's it ;-)
Now it's working...

Thanks a lot

Matthias
gpaed.de