Speeding up page generation on large sites

Search engine friendly UL list type menu for Actinic V8 and V9. Styled by CSS and animated by a small JavaScript.
Post Reply
norman
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

Speeding up page generation on large sites

Post by norman »

If you have a huge site NorList may take a long time to generate.
This is due to it having to work through all Sections on every page, with a potential workload that could be the square of your page count.

The following will generate NorList only on non-Section pages and remember the generated HTML.
Section pages will use the previously generated code.

In your Overall Layout(s), replace the line:

Code: Select all

<actinic:variable name="NorList Dynamic Menu" />
with:

Code: Select all

<actinic:block php="true">
// NorList Speedup V1.03
	if (! isset($menuhtml) ) $menuhtml = "Menu not generated.<br/>Switch to a non-Section page to regenerate menu.";
	$previewing = <actinic:variable name="IsPreviewMode" selectable="false" />;
</actinic:block>
<actinic:block if="%28%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%22Section%22%29%20AND%20%28%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%22%22%29" >
	<actinic:block php="true">
		$menuhtml = <<<ENDOFMENUHTML
<actinic:variable name="NorList Dynamic Menu" />
ENDOFMENUHTML;
		if ($previewing == 0) $menuhtml = str_replace("href='P_", "href='", $menuhtml);
		echo $menuhtml;
	</actinic:block>
</actinic:block>
<actinic:block if="%28%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Section%22%29%20OR%20%28%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22%22%29" >
	<actinic:block php="true">
		if ($previewing == 0) $menuhtml = str_replace("href='P_", "href='", $menuhtml);
		echo $menuhtml;
	</actinic:block>
</actinic:block>
NOTES:

N.B. The code above should be pasted into your Overall Layout(s) with no left hand margin.

If you start Actinic with a Section page selected, a warning message will be displayed, reminding you that the menu won't be generated until a non-Section is displayed. Switch to a Brochure page to regenerate the menu. This won't be a problem on site updates as the other pages that refresh the menu are generated first.

Likewise, if you add/remove Sections, the menu won't update until a non-Section is displayed. Switch to a Brochure page to regenerate the menu. This won't be a problem on site updates as the other pages that refresh the menu are generated first.

CHANGE LOG:

04-11-10 V1.03 Allow for use with Corporation Theme.
26-08-08 V1.02 Preview code wasn't working correctly.
26-08-08 V1.01 Amended to remove spurious P_ from URL's on live pages.
Norman
Post Reply