Re: Speeding up H::T

Matthew <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <[email protected]>
Sam,

> Are you pre-caching your templates in startup.pl?  There's a recipe

	Nope. I found the recipe and will try to incorporate that later this week.

> Also, are you loading many templates and doing includes manually?
> Switching to tmpl_include (which is processed at compile time) can be

	Not sure what you mean. Here is my object creation line, which is 
inside sub handler() ($template is a global var):

$template = new HTML::Template(
      filename => 'background.tpl',
      path => [ '/home/omnovia/public_html/pages/sctest/templates/' ],
      die_on_bad_params => 0,
      cache => 1
);

background.tpl contains this:

<TMPL_VAR NAME="HEADER">

   <TMPL_IF NAME="MESSAGEDIE">
     <TMPL_INCLUDE NAME="messagedie.tpl">
   <TMPL_ELSE>

     <TMPL_IF NAME="LOGIN_MENU">
       <TMPL_INCLUDE NAME="login_menu.tpl">
     </TMPL_IF>

     <TMPL_IF NAME="LOGIN_PAGE">
       <TMPL_INCLUDE NAME="login_page.tpl">
     </TMPL_IF>

     <TMPL_IF NAME="STRUCTURE_PAGE">
       <TMPL_INCLUDE NAME="structure.tpl">
     </TMPL_IF>

   </TMPL_IF>

<TMPL_VAR NAME="FOOTER">

in my code, if I need to display a certain sub-page, I just set one of 
the IF's above to 1 and parse the variables.  Is this the wrong way of 
doing this?

Thanks,
Matthew

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.