Chris Faust wrote:
> Folks,
> 
>  
> 
> I'm having (what I hope is) a syntax problem.
> 
>  
> 
> I'm trying to use the "filter" option to run a sub on a template at 
> create time, but I want the sub in another package and I need to some 
> other objects with it.
> 
>  
> 
>  From reading the docs I thought that the HTML::Template object would 
> simply be the first incoming param, but its not.
> 
>  
> 
> For example, here is how I wanted to create my template object:
> 
>  
> 
>  my $template_header = new HTML::Template(filename => 'CommonHeader.tmpl',
>            filter  => { sub => 
> scripts::MyPackage->initialize_template_header($r,$db,$site_settings,$user_session_data,\%form_data)
>  
> },
>            );
> 
>  
> 
> Then in "MyPackage.pm", I would have
> 
>  
> 
> sub initialize_template_header {
>  my 
> ($self,$template,$r,$db,$site_settings,$user_session_data,$form_data) = @_;
> ....
> 
> }
> 
>  
> 
> $self is correctly defined, but $template becomes the first object I 
> send in ($r in this case).
> 
>  
> 
> How do I get the HTML::Template object??
> 


This may have an answer for you:

http://www.perl.com/pub/a/2006/11/30/html-template-filters.html

HTH

Robert


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to