If there is a sensible debugging strategy for TT2 especially for ttree
and tpage users, I've yet to figure it out.

I had a system that worked last spring.  Now it doesn't.    Whole
bunch of things have changed, so it's just a matter of trying things.

Searching the archives I found a post where A. himself says that the
nature of the parser is such that debugging is difficult to do, and
that he didn't want to throw much effort into it, since he was bound
and determined to replace tt2 with tt3.  That was some time ago, and
alas, tt3 isn't here yet.  (Andy?  Time frame?)

Anyway, currently this is the headache:


The content of ttfiles

seq:df:path:depth:fname:lname
AAAAA:d:/Home:1:Home:Home
AAAAB:f:/Home/Home.html:2:Home.html:Home
AAAAB:f:/Home/The_SFTF_Advantage.html:2:The_SFTF_Advantage.html:The
SFTF Advantage


     58 [% USE mtree = datafile("$ttfiles") %]

     60 [%      FOREACH page = mtree ;
     61                 child = page.fname.replace('.html','');
     62                 parent = page.path.split('/').last(2).first;
     63                 template_parent = template.name.replace('/\w+.tt2$','');
     64                 IF child == parent ;
     65                         NEXT ;
     66                 END; #if
     67                 MenuLevel = page.depth; %]
     68
     69         Menulevel is [% MenuLevel +%]
     70
     71         [%      path_so_far = "/" _ pathchunks.first(1).join('/') ; %]
     72         [%      path_so_far = "/" _ pathchunks.first(2).join('/') ; %]
     73         [%      path_so_far = "/" _
pathchunks.first(page.depth).join('/') ; %]
     74         [%      path_so_far = "/" _
pathchunks.first(MenuLevel).join('/') ; %]
     75


Lines 71-73 are an effort to localize what was causing the error.  74
was the one that was giving me a headache orginally.

When I run it, I get
Use of uninitialized value in subroutine entry at lib/header.inc line 72.
Use of uninitialized value in subroutine entry at lib/header.inc line 73.

One copy for each line in $ttfiles

This tells me that page.depth has problems.

But if I look in the output file,
...
  Menulevel is 1
                <p class="L1"><a href="/Home/Home.html"
class=current>Home</a></p>      Menulevel is 2
                <p class="L2"><a href="/Home/The_SFTF_Advantage.html"
>The SFTF Advantage</a></p>       Menulevel is 2
                <p class="L2"><a
href="/Home/Business_Stuff/Business_Stuff.html" >Business
Stuff</a></p>        Menulevel is 3
      Menulevel is 3
      Menulevel is 3
      Menulevel is 3
      Menulevel is 3
...
I get all kinds of output from that menulevel line.

So I'm perplexed

I don't think I've given enough information for someone to solve my
problem, although if something jumps out at you, let me know.

What I would like would be some general methods for a ttree user to
debug stuff like this.

Meanwhile, I am going to try to simplify this problem and get the
minimum example.  With any luck that will locate my problem.
And without that luck, I'll have a smaller example I can post for
further guidance.




-- 
Sherwood Botsford
Sherwood's Forests
Warburg, Alberta T0C 2T0
http://www.sherwoods-forests.com
780-848-2548

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to