Hi, folks,

I've got a lot of job with refactoring of old procedural script to new
OO ones. The end is near, and job not fear, but I'm tryin to implement
a so called "Composite view" pattern in Perl. Here it is a "Facade" influence too:

our $templ_path = 'foo/bar/etc'

sub composite_view
{
  my ( $template,$data) = shift;
  my $logo_links   = logo_links();
  my $navigate_bar = navigate_bar();

  my $footer_html  = footer_html();
  my $tmpl = '';

  if ($data)
  {
    $tmpl = new HTML::Template( filename => 
"$templ_path/templates/anemon.$template.tmpl" );
    $tmpl->param( data=>$data );
    my $content = $tmpl->output;
  }
  else
  {
    $tmpl = new HTML::Template( filename => 
"$templ_path/templates/anemon.$template.tmpl" );
    my $content = $tmpl->output;
  }

  $tmpl = new HTML::Template( filename => 
"$templ_path/templates/anemon.composite_view.tmpl" );
  $tmpl->param( 
content=>$content,logo_links=>$logo_links,navigate_bar=>$navigate_bar,footer_html=>$footer_html
 );

  header_html();
  print $tmpl->output;
}
  
this sub works fine, but there are three instances of H::T class. May be it
will be profitable to all of us to create a method for example
'filename' to change Template filename?
What are your opinions?
-- 
Sweetest regards,
 Sergey Velikanov                    mailto:[EMAIL PROTECTED]




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to