Variable scope in SSI

windows

Guest
My Web site framework uses server-side includes and SHTML files so that content is separated from all of the decoration, style sheets, primary navigation menu, etc. The basic structure is that every page does a #include of header and footer files containing the site-generic stuff. Within the header file, I then do a #include on two other files, one of which displays a colored bar that visually indicates what section of the site the page belongs to and the other of which displays a sidebar that has navigation elements appropriate for that section.<br />
<br />
What I need to be able to do is pass a variable from the top-level page into the header file, so that I know within the header file what section the page belongs to and therefore what files to include for the section-specific stuff.<br />
<br />
I tried using<br />
<br />
<!--#set var="section" value="frontpage" --><br />
<br />
in the top-level file (in this case, frontpage.shtml) and then putting the following into the included header:<br />
<br />
<!--#include virtual="/framework/$section/activebar.inc" --><br />
<br />
Each section has its own subdirectory of /framework, so the idea is that this would be resolved as (in this case) ?framework/frontpage/activebar.inc?<br />
<br />
Unfortunately, the Web server appears to process the #include in the header file before it processes the #include in the main file, which means that the variable is undefined. If I put that #include into the main page directly rather than the header file, it works.<br />
<br />
I鎶砮 been searching around the Web for a simple solution to this conundrum because I鎶
 
Back
Top