Gossamer Forum
Quote Reply
Mystery Hook
I'm trying to find the name of the hook that I can use as a PRE hook before the main category page loads. I can't find the name. Anyone know?

I don't think it is display_category or display_group

Last edited by:

RedRum: Mar 12, 2002, 6:34 AM
Quote Reply
Re: [RedRum] Mystery Hook In reply to
Ahhh is it:

do_cat_list ?

If so how do I return a hashref of tags. The argument seems to be cat_list - a scalar

Last edited by:

RedRum: Mar 12, 2002, 6:48 AM
Quote Reply
Re: [RedRum] Mystery Hook In reply to
Hi,

The arguments returend for all do=functions should be ('templatename.html', { template args }, { template opts }). That way you can change the template or the arguments easily.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Mystery Hook In reply to
Ahh, ok thanks.
Quote Reply
Re: [Alex] Mystery Hook In reply to
Shouldn't this work in that case?

Code:
my $tpl = shift;
my $args = {};
my @list = $DB->table('Online')->select( { guest_id_fk => 0, online_invisible => 0 } )->fetchall_list;

$args->{mylist} = join ', ', @list;

return ($tpl,$args);

?

I get an unknown tag error for <%mylist%>

Last edited by:

RedRum: Mar 12, 2002, 9:17 AM
Quote Reply
Re: [Paul] Mystery Hook In reply to
Still not figured this out yet.
Quote Reply
Re: [Paul] Mystery Hook In reply to
Hi,

No, this won't work. The program flow is:

1. Run all PRE hooks.
2. Run main code that generates the category list page. It returns $template_name, $template_vars, $template_opts.
3. Run all POST hooks.
4. Print $template_name with $template_vars

So if you are just looking at adding a new tag and not change the functionality of the home page, you want to add a POST hook that looks like:

Code:
sub my_post_hook {
my ($tpl, $args, $opts) = @_;
$args->{mylist} = '.....';
return ($tpl, $args, $opts);
}


So you basically just added a new template tag. If you wanted to replace the functionality of the home page, you would do a PRE hook that looked like:

Code:
sub my_pre_hook {
my $do = shift;
GT::Plugins->action ( STOP ); # Don't run main code.
... # Your code here
return $template, $args, $opts;
}


And the program will print out $template with $args as options.

Let me know if this helps,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Mystery Hook In reply to
Doh...thanks.

I was using a pre hook thinking I needed to generate the new tag before anything else happened.

>>So if you are just looking at adding a new tag and not change the functionality of the home page<<

Yeah...I just wanted to add a new tag and not change the functionality.

Thanks for setting me straight!