Once you have created one or more Navigations on your LiveWhale CMS site, you’ll want to display them in your templates and includes.
Displaying the current navigation
In the page template, you can display the current group or section navigation using the following XPHP variables:
Group | Section | Description |
---|---|---|
<xphp var="group_title" />
|
<xphp var="section_title" />
|
Name of group or section |
<xphp var="group_title" />
|
<xphp var="section_title" />
|
Link to group or section homepage |
<xphp var="group_navigation" />
|
<xphp var="section_navigation" />
|
Group or section navigation |
Display section navigation when available (LiveWhale 2.10.6 and before)
If you want to use the same page template whether or not the page is in a section, use a simple XPHP if/then.
<xphp content="true">
<if var="section_navigation"/>
<content>
<xphp var="section_navigation"/>
</content>
<else content="true">
<content>
<xphp var="group_navigation"/>
</content>
</else>
</xphp>
The above code says, “if this page has a section navigation, show that; otherwise, show the group_navigation.”
Display section navigation when available (LiveWhale 2.10.7+)
LiveWhale 2.10.7 introduced a simpler method using show_section_navigation which will show a section navigation when available, otherwise falling back to the full navigation.
<widget type="navigation">
<arg id="group">me</arg>
<arg id="show_section_navigation">true</arg>
</xphp>
This idea (show just a section if the current page is part of a section, otherwise show the full navigation) also works when specifying the nav by ID.
<widget type="navigation">
<arg id="id">35</arg>
<arg id="show_section_navigation">true</arg>
</xphp>
Showing only the links around your current page
By default, a LiveWhale navigation will show
- All pages above the current page, all the way up to the Group homepage
- The current page and all its siblings (current page is highlighted)
- All the immediate children of the current page
Since LiveWhale 2.0, there is a new option to show only the “immediate family” around the currently active page. When enabled, the navigation widget will instead display
-
All pages above the current page, all the way up to the Group homepage
The current page’s immediate parent - The current page and all its siblings (current page is highlighted)
- All the immediate children of the current page
You can enable this on a per-widget basis by adding <arg id="only_immediate_family">true</arg>
to your navigation widget, or enable it site-wide by adding this line to livewhale/client/public.config.php.
$_LW->CONFIG['USE_ONLY_IMMEDIATE_FAMILY_IN_GROUP_NAVIGATION']=true;
Displaying the current breadcrumb menu
You can use <xphp var="group_breadcrumb" />
in your template to display the current group’s navigation in breadcrumb form. For a more advanced display, you can customize your own breadcrumb widget:
<widget type="breadcrumb">
<arg id="main_nav">Academics</arg>
</widget>
Widget Options | Description | Default | Example |
---|---|---|---|
id | Display this navigation by ID |
<arg id="id">123</arg>
|
|
main_nav | Display the main navigation for this group (by name) |
<arg id="main_nav">Admissions</arg>
|
|
separator | Separate pages with this character | » |
<arg id="separator">-</arg>
|
levels | Display a max number of pages in the path | unlimited |
<arg id="levels">3</arg>
|
Customizing the breadcrumb display site-wide
The above widget options allow you to customize the separator and levels on a per-widget basis, but if you’d like to change them site-wide, you can uncomment and edit the following lines in livewhale/client/public.config.php.
$_LW->REGISTERED_WIDGETS['breadcrumb']['custom']['levels']=0; // max # of levels to show for breadcrumb steps (default: 0 i.e. all levels)
$_LW->REGISTERED_WIDGETS['breadcrumb']['custom']['separator']='»'; // separator character to display between breadcrumb steps (default: ») (Please use numeric entities instead of named entities.)
Extended breadcrumbs
By default, a LiveWhale breadcrumb menu starts from the homepage of your current group and then traverses down the navigation to the currently active page. Since LiveWhale 2.0, there is an additional option for “extended” breadcrumbs that also traverse up into parent directories above the current group’s homepage. You can enable this on your dev site and experiment by adding this line to livewhale/client/public.config.php.
$_LW->CONFIG['ENABLE_EXTENDED_BREADCRUMBS']=true;