Well ErnieAlex, you are a real superstar. That last post was exactly the recap I needed and I was able to code it in about 5 minutes.
The good news, I have learned something. The bad news, the menu still takes a few seconds to load (on a slow internet connection, a half second on high speed).
The text file outputted is 250kb, so I think it is quite simply the amount of stuff that is in the submenus that is causing the lag.
But, in case anyone wants to review this post in the future, here is the code I used:
1) Capture the html that my php script creates, then write it to a file:
[php]
ob_start();
/* MY PHP SCRIPT */
$HtmlCode= ob_get_contents();
ob_end_flush();
$LogFileLocation = “/z_header/HeaderHTML.txt”;
$fh = fopen($_SERVER[‘DOCUMENT_ROOT’].$LogFileLocation,‘at’);
$myFile = “HeaderHTML.txt”;
fwrite($fh, $HtmlCode);
fclose($fh);
[/php]
2) Load this txt file rather than my script:
[php]
$LogFileLocation = “/z_header/HeaderHTML.txt”;
$fh = fopen($_SERVER[‘DOCUMENT_ROOT’].$LogFileLocation,‘r’);
$HeaderData = fread($fh, filesize($_SERVER[‘DOCUMENT_ROOT’].$LogFileLocation));
fclose($fh);
echo $HeaderData;
[/php]
Note that there would still need to be some coding done to ensure that the php script is run on the first page view (to refresh the text file with the latest menu, since it changes every so often) and that on subsequent page views in that same session, it loads the text file instead.
I am not an expert in this, but perhaps for closure of this thread you could just confirm what would be the best way to do this.
Thanks again for your kind and generous help, it was much appreciated. I am truly happy to have learned this.