Hi Jason,

I personally think this is a good idea, especially if it was provided by a plugin (which means other TMPL_xxx's would also be possible).


In this case probably what you want is to use a TMPL_VAR which contains the output of a seperate H::T instance, as in:

my $ht = new H::T(filename => "helloworld.tmpl");
my $helloworld = $ht->output();
$ht = new H::T(filename => "index.tmpl");
$ht->param("helloworld" => $helloworld);
$ht->output();

or something like that, ie: generate your virtual's before generating your output.

Mathew


Jason Purdy wrote:
How about a new tag, either as part of the standard distribution or a 
plugin:

TMPL_VIRTUAL

The one thing that I like when I'm doing PHP pages is that I can build 
singular dynamic components and simply include them from the parent 
template.

i.e.

# FILE: index.php
<? virtual( 'helloworld.php' ); ?>


# FILE: helloworld.php
<? print "Hello World!"; ?>

Yes, I know about Philipp's Widgets articles[1] on perl.com, but you 
still need to put the encapsulation logic in your code, which seems 
redundant.

How about if the HTML_VIRTUAL called LWP to request the URL and replace 
the tag w/ the response's content?

# FILE: index.TMPL
<!-- TMPL_VIRTUAL URL="helloworld.php" -->

# FILE: helloworld.php
<? print "Hello World!"; ?>

- Jason

[1]: http://www.perl.com/pub/a/2007/02/02/htmltemplate-widgets.html

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users