Navigation and Breadcrumbs

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 conditionally

If you want to use the same page template whether or not the page is in a section, use a simple XPHP if/then.

1
2
3
4
5
6
7
8
9
10
11
<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.”

By default, a LiveWhale navigation will show

  1. All pages above the current page, all the way up to the Group homepage
  2. The current page and all its siblings (current page is highlighted)
  3. 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

  1. All pages above the current page, all the way up to the Group homepage
    The current page’s immediate parent
  2. The current page and all its siblings (current page is highlighted)
  3. 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.

1
$_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:

1
2
3
<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.

1
2
$_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.

1
$_LW->CONFIG['ENABLE_EXTENDED_BREADCRUMBS']=true;