nestable template engine: ------------------------- base: Top <insert> header footer ------------------------- two columns (uses base): Middle <insert> contentHeader contentFooter menuHeader menuFooter -------------------------------- actual page (uses two columns): Inner Hello this is content. Link1 | Link2 | Link3 --------------------------------------------------------- 1. start processing from top most template 2. start processing section from top most section, order top-> bottom in code 3. insert: insert everything between the section tags in the next template, ignore sections defined in the top most template (including the section tags themselves), 4. when all sections defined in top most where processed, restart with the new assembled source and next template if any, else, output. ------------------------- resulting page: Top Middle Inner contentHeader Hello this is content. contentFooter menuHeader Link1 | Link2 | Link3 menuFooter before footer