Re: [htmltmpl] Feature Idea [TMPL_VIRTUAL]
Brought to you by:
samtregar
From: Mathew R. <mat...@ne...> - 2007-04-03 23:01:05
|
Hi Jason, Are you simply looking for something like TMPL_INCLUDE ? Mathew Jason Purdy wrote: > Thanks for the thoughts! > > I'm not sure I understand what you're saying here. If you're saying > you can just use nested TMPL_VARs, then I think you may be missing my > point. Your code: > > > my $ht = new H::T(filename => "helloworld.tmpl"); > # Don't forget you need to also put together $ht's parameters > > my $helloworld = $ht->output(); > > $ht = new H::T(filename => "index.tmpl"); > > $ht->param("helloworld" => $helloworld); > > $ht->output(); > > Whereas if you had something like TMPL_VIRTUAL, you could eliminate > the first 3 lines (or more) of code since the index.tmpl would have a > TMPL_VIRTUAL to point to a cgi script that put together the output of > helloworld.tmpl. > > Hmm - I think I may have just realized what you were talking about, > but this whole feature wouldn't be useful for including nested > templates, but rather the output from a URL (i.e. a cgi script, php > page, etc) > > Sorry for the rambling ... this whole email may not make sense ... > haven't digested my coffee yet! ;) > > - Jason > > > Mathew Robertson wrote: >> 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 >>> Htm...@li... >>> https://lists.sourceforge.net/lists/listinfo/html-template-users >>> |