If I am not mistaken, max_includes is supposed to prevent *recursive*
includes, but is it also supposed prevent a single template from
including more than x number of templates at all (i.e. not
recursively)?  A quick test showed that this is also prevented.

With that assumption, I'm trying to figure out how that counter is
generated.  Leaving the default max_includes to 10 as is, I have created
10 files, named file1.html..file10.html.  They all have the exact
content, which is a single INCLUDE tag:

--

<TMPL_INCLUDE NAME="content.html">

--

I then created a file called test.html, with this content:

--

<TMPL_IF false><TMPL_INCLUDE NAME="file1.html"></TMPL_IF>
<TMPL_IF false><TMPL_INCLUDE NAME="file2.html"></TMPL_IF>
<TMPL_IF false><TMPL_INCLUDE NAME="file3.html"></TMPL_IF>
<TMPL_IF false><TMPL_INCLUDE NAME="file4.html"></TMPL_IF>
<TMPL_IF false><TMPL_INCLUDE NAME="file5.html"></TMPL_IF>
<TMPL_IF false><TMPL_INCLUDE NAME="file6.html"></TMPL_IF>
<TMPL_IF false><TMPL_INCLUDE NAME="file7.html"></TMPL_IF>
<TMPL_IF false><TMPL_INCLUDE NAME="file8.html"></TMPL_IF>
<TMPL_IF false><TMPL_INCLUDE NAME="file9.html"></TMPL_IF>
<TMPL_IF false><TMPL_INCLUDE NAME="file10.html"></TMPL_IF>

--

Here's my perl script:

--

#!/usr/bin/perl

use HTML::Template;

my $template = HTML::Template->new( filename => "test.html" );
print $template->output();

--

Running the script above, I received the following error:
"likely recursive includes - parsed 10 files deep and giving up"

Ok, so INCLUDEs are counted regardless of whether a condition
surrounding them is true or not.  Now another question is, are each of
the INCLUDEs inside each file1..file10 being counted as well?  If they
aren't, I should be able to remove one line from test.html, leaving 9
INCLUDEs, and it should work.  I removed the last statement from
test.html, which INCLUDEs file10.html, and found that the script worked,
meaning that the INCLUDE statements inside of each file1..file10 are not
being counted.

I know that TMPL_INCLUDES are processed before anything else, which may
explain why conditions don't matter.  However, am I just making the
wrong assumption that "10 files deep" refers to recursion, not just any
kind of includes?

--Alex

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to