Site Menu (v. 1.2)

Kooboo provides some simple API methods to build the menu structure.

Define the menu tree



When you are defining a page, there are 4 fields related to the menu.
Kooboo page menu setting
Nav Parent: The parent page on navigation tree.
Show In Menu: Appear on navigation tree or not
Navigation Text: Link Text, the page object also has a LinkText Property which will get the page name when navigation text is not available.
Navigation Order: Sort order

To make a page appear in the menu tree, "Show In Menu" must be checked.

Query the Menu


In Kooboo 1.2, there are 4 new menu API added, similar as the previous API. Those API will return one or more page objects, you can use Kooboo PageLink method to build the page link/menu.
Kooboo page menu api
GetTopPages: The root pages on navigation tree.
GetParentPage: Get the parent page object.
GetSubPages: Get sub page objects of current page.
GetSilbingPages: Get the pages in the same level.

The 4 API methods from Kooboo 1.1 are still kept in 1.2, just for backward compatibility reason.

getNavigation: Get sub pages of one cms_page
GetParentNavigation: Get the parent page object of one cms_page.
GetSubNavigations: Get the child list of cms_page object of current cms_page
GetTopNavigations: Get the list of root cms_pages, those page do not have parent page.
Below are some sample code to build the menu tree based on new API. There is also a menu module which can be used for similar purpose.



Below are some sample code for building the site navigation based on old API.