-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

* alex <alex at state51.co.uk> [2003-07-17 11:20]:
> On Thu, 2003-06-05 at 16:03, Perrin Harkins wrote:
> > Actually, the include path has always been a dynamic option in TT2.
> > It wasn't very obvious until recently though.
> 
> coming back to an old thread...
> 
> can i do something like 
> 
>   $tt->include_path(['/here/', '/over/here']);

Template::Provider has an include_path method that you can use to, well,
set INCLUDE_PATH.  The context has an array of Template::Provider
objects (by default just 1) in LOAD_TEMPLATES.  From your Template
object, you'd have to get to it via something like:

  $tt->context->load_templates->[0]->include_path([EMAIL PROTECTED]);

Or, much cleaner:

  my $tp = Template::Provider->new(\%options);
  my $tt = Template->new({
      LOAD_TEMPLATES => [ $tp ],
      %options,
  });

And then set the include_path via:

  $tp->include_path([EMAIL PROTECTED]);

Or, something like:

  my $tp = Template::Provider->new(\%options);
  $tt = Template->new({
      INCLUDE_PATH => [
          sub { $tp->include_paths([EMAIL PROTECTED]) },
      ],
  });

(darren)

- -- 
What the imagination siezes as beauty must be truth -- whether it
existed before on not.
    -- John Keats
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: This message is digitally signed and can be verified for authenticity.

iD8DBQE/FsC2zsinjrVhZaoRAgc9AJ9z616G9CBMFe+EaMH8PDdddZ7P2QCfVP3m
ez7t5290hDVXAbi/aein8Ys=
=QPZN
-----END PGP SIGNATURE-----

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to