* Paul <[EMAIL PROTECTED]> [2002-12-03 13:38]:
> How would I go about generating site navigation breadcrumbs with TT?
> 
> As in:
> 
> Home > SubSection1 > SubSection2 > CurrentPage

I've implemented this before, using a simple method:  Each directory has
a file called .nav that contains it's nav info.  E.g.:

  # foo/.nav
  <a href="foo/">Foo</a>

My processor takes the URI (passed as a parameter) and tries to PROCESS
each .nav file:

  [%  MACRO breadcrumb(uri) BLOCK;
          uris = [ ];
          cur  = "";

          FOREACH u = uri.split("/");
              cur = "$cur/" IF cur.length;
              cur = "$cur$u";
              uris.push(cur);
          END;
          FOREACH u = uris;
              " &gt; " UNLESS loop.first;
              u = "$u/" IF u.length;
              u = "${u}.nav";
              TRY;
                  PROCESS $u;
              CATCH;
                  CLEAR;
              END;
          END;
      END;
  -%]

It's not particularly efficient, but it worked for me.

In the case of [% breadcrumb("/foo/bar") %], this will process
foo/bar/.nav, then foo/.nav, then .nav, if they exist, and joins the
output on " > ".

(darren)

-- 
Every nonzero finite dimensional inner product space has an
orthonormal basis.

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.ourshack.com/mailman/listinfo/templates

Reply via email to