Instead of going through this somewhat voluminous example, I'll just point out the excellent module Template Toolkit which should allow you to separate the logic from the presentation.
In reply to Re: Excluding pages from the navigation
by talexb
in thread Excluding pages from the navigation
by webteam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |