n2n Page Rocket 1 API

page\ui

­Page­Html­Builder

PageHtmlBuilder
PageHtmlBuilder provides methods for simple html output in views dependent on the state of the site. It looks up PageState to determine the current page.

Methods summary

Modifier and Type Method
public __construct ( HtmlView view )
public PageHtmlBuilderMeta meta ( )
public title ( string|UiComponent|null overwriteTitle = null )
public UiComponent getTitle ( unknown overwriteTitle = null )
public contentItems ( string panelName )
public UiComponent|null getContentItems ( string panelName )
public navigation ( NavComposer navComposer = null , array attrs = null , array ulAttrs = null , array liAttrs = null , array aAttrs = null )
public UiComponent getNavigation ( NavComposer navComposer = null , array attrs = null , array ulAttrs = null , array liAttrs = null , array aAttrs = null )
public breadcrumbs ( array attrs = null , array liAttrs = null , array aAttrs = null , string divider = null )
public UiComponent getBreadcrumbs ( array attrs = null , array liAttrs = null , array aAttrs = null , unknown divider = null )
public localeSwitch ( array ulAttrs = null , array liAttrs = null , array aAttrs = null )
public UiComponent getN2nLocaleSwitch ( array ulAttrs = null , array liAttrs = null , array aAttrs = null )

Methods in detail

  • __construct

    public __construct ( HtmlView view )

    You can instance PageHtmlBuilder in every HtmlView by using $pageHtml = new PageHtmlBuilder($view);

    param
  • meta

    PageHtmlBuilderMeta public meta ( )
  • title

    public title ( string|UiComponent|null overwriteTitle = null )
    Prints the html encoded title of the current page or the page name specified in app.ini if there is no current page.
    param
    string|UiComponent|null overwriteTitle prints just passed value if not null
  • getTitle

    UiComponent public getTitle ( unknown overwriteTitle = null )
    Same as PageHtmlBuilder::title() but returns the output.
  • contentItems

    public contentItems ( string panelName )

    Prints the content items of the current page which are assigned to the panel with passed name.

    <div><?php $pageHtml->contentItems('main') ?></div>
    

  • getContentItems

    UiComponent|null public getContentItems ( string panelName )
    Same as PageHtmlBuilder::contentItems() but returns the output.
    return
    n2n\web\ui\UiComponent|null
  • navigation

    public navigation ( NavComposer navComposer = null , array attrs = null , array ulAttrs = null , array liAttrs = null , array aAttrs = null )

    Prints a customized navigation.

    Usage example

    <?php $pageHtml->navigation(Nav::root()->levels(2), array('id' => 'main-navigation')) ?>
    

    param
    NavComposer

    $navComposer

    Use Nav to build a suitable NavComposer. If you pass null, the default NavComposer will be used (Nav::root()).

    See Nav for further information.

    array attrs html attributes of the outer ul
    array ulAttrs html attributes of every inner ul
    array liAttrs html attributes of every li
  • getNavigation

    UiComponent public getNavigation ( NavComposer navComposer = null , array attrs = null , array ulAttrs = null , array liAttrs = null , array aAttrs = null )
    Same as PageHtmlBuilder::navigation() but returns the output.
  • breadcrumbs

    public breadcrumbs ( array attrs = null , array liAttrs = null , array aAttrs = null , string divider = null )

    Prints a breadcrumb navigation of the current page in form of a ul-/li-list.

    Also see PageHtmlBuilderMeta::getBreadcrumbNavBranches() to find out how to build a breadcrumb navigation.

    param
    array attrs Html attributes of the ul element.
    array liAttrs Html attributes of each li element
    string divider Pass a UiComponent or string if a divider span element should be printed in each li element.
  • getBreadcrumbs

    UiComponent public getBreadcrumbs ( array attrs = null , array liAttrs = null , array aAttrs = null , unknown divider = null )
    Same as PageHtmlBuilder::breadcrumbs() but returns the output.
  • localeSwitch

    public localeSwitch ( array ulAttrs = null , array liAttrs = null , array aAttrs = null )

    Prints a locale switch navigation of the current page.

    Also see PageHtmlBuilderMeta::getN2nLocaleSwitchUrls() to find out how to customize the output.

    param
    array ulAttrs
    array liAttrs
  • getN2nLocaleSwitch

    UiComponent public getN2nLocaleSwitch ( array ulAttrs = null , array liAttrs = null , array aAttrs = null )
    Same as PageHtmlBuilder::breadcrumbs() but returns the output.