After I posted the above comments, I looked through this thread and found the navigation tab issue brought up over and over, with no satisfactory answer. I think it is pretty important to be able to have more than one WebTemplate-generated page linked to in the navigation bar and still have the 'Selected' function of the nav tabs work. I'm not sure why something this fundamental wasn't addressed long ago.
The answer was a simple one. I put a conditional statement above the line where the 'THIS_SCRIPT' constant was defined. It takes the pg= value and assigns it as the THIS_SCRIPT constant.
Drawing from something Logician did, I took it a step further and looked for an underscore in the pg= value. If one was found, the text to the left of the underscore and the underscore itself becomes the THIS_SCRIPT value. This way, if there are a large number of submenu items for a WebTemplates-generated page, all of the sub-pages can highlight the correct navigation tab if the same prefix is used in their template names, without having to list each of their THIS_SCRIPT values in the navigation tabs admin area. That variable only allows 30 characters of data, so that capacity could quickly become exhausted.
In the canned templates installed with this mod, every template that used the Site Information Pages Template theme has a template name that starts with 'info_'. With this naming schema, every Webtemplates-generated page that used that prefix would highlight the same navigation tab using my mod to this mod, if the value 'info_' was added as the Tab Script(s) value for that tab.
Anyway, I am a little embarrassed to share the code I used. I am a PERL programmer that is new to PHP and I couldn't get the Regex conditionals to function for me cleanly in PHP, so the code is a little sloppy. It works great though. In the view.php file, replace the
PHP Code:
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'view');
with the code below.
PHP Code:
// #################### DEFINE IMPORTANT CONSTANTS #######################
if (preg_match('/view\.php/i', $_SERVER['REQUEST_URI'])) {
$SelectResult = preg_split( '/=/', $_SERVER['REQUEST_URI'] );
$SelectVariable = $SelectResult[1];
if (preg_match('/_/i', $SelectVariable)) {
$SelectResult2 = preg_split( '/_/', $SelectVariable );
$SelectVariable = $SelectResult2[0] . '_';
}
} else {
$SelectVariable = 'view';
}
define('THIS_SCRIPT', $SelectVariable);
The THIS_SCRIPT value will then be whatever you named a given template, unless your template name has an underscore '_' in it. Then, it will be all of the name left of the underscore and the underscore itself. I left the underscore in there to prevent any accidental matches with other names. 'Info', for instance, might get used in a variable name that did not start with 'info_'.
I hope this info helps. If you find this helpful and can clean up my See-Spot-Run Regex's in my code, I'd appreciate it if you could post the cleaned up code here, so I can see what I was doing wrong. I had to use the two preg_split commands because I couldn't pull the relevant data out of the string in the conditional matches. This is really easy in PERL. I suspect it is in PHP as well. I just got tired of trying to make it work. Thanks and thanks again to Logician, for a wonderful mod.