When you perform a server installation of Consolo with the Congifuration Tool, you can also install supporting functions for PHP. The files inc_getStructure.php and inc_xml.php will then be included. You will find them in Consolo’s system folder consolo/. The first file contains the supporting function getStructure() which analyzes the page structure file consolo/register/structure.xml and generates a <ul><li>-formatted list. The other file contains a number of functions which improve the xml-support in PHP.
If you don’t have the files, you can download them here ». Note that in inc_getStructure.php you have to replace the text %subfolder% with the name of the folder on the server in which Consolo is installed.
The function getStructure() has to be included on all the pages that will be generating the page structure, but it is recommended to make the request through another script, which in turn is included on every page. This will make it easier to change the request in the future, and have the change implemented all over the web site at once. For example, you can create a file inc/incHeader.php that you include in the beginning of every page. The file incHeader.php can look like this:
The above example will only work if the server supports the variable DOCOMUENT_ROOT. If not, you have to hard code this value.
As you can see, a request is made to getStructure. The request only calls the first level of the structure. The function is called like this:
Parameters
|
Name |
Meaning |
Description |
|---|---|---|
sActivePage |
Active page | A string that decides what page is set to active, usually SERVER [“SCRIPT_NAME”] |
iFromLevel |
From level |
Integer which sets the initial level of the list. |
iToLevel |
To level |
Integer which sets the end level of the list. |
bExpandAll |
Expand all |
Boolean which decides wether all folders should expand. If False, only the active folder, if existing, will expand. |
sHeader |
Header |
String with a header for the list to begin with. If sHeader = “auto” and iFromLevel is greater than 1, a header will be added automatically.< /SPAN > |
Example 1: Top Navigation. Get all the pages at the first level.
Example 2: Sub-Navigation. Get all the pages from level two to four.
Example 3: Complete structure, but only get pages up to level five.
Example 4: Complete structure, but only expand the current search path.